Sha256: 0d4a0b1b893b585eae516363daba94d012a4ca60b4aa0f783524e06001785670

Contents?: true

Size: 873 Bytes

Versions: 3

Compression:

Stored size: 873 Bytes

Contents

# frozen_string_literal: true

require "yaml"

module MermaidErdMarkdown
  class Configuration
    attr_accessor :output_path, :split_output, :relationship_depth

    def initialize
      config = {
        output_path: "app/models/ERD.md",
        split_output: false,
        relationship_depth: 1
      }
      erd_config_path = "erd.yml"

      begin
        erd_yml = YAML.safe_load File.open(erd_config_path)
        @output_path = erd_yml["erd"]["output_path"] || config[:output_path]
        @split_output = erd_yml["erd"]["split_output"] || config[:split_output]
        @relationship_depth = erd_yml["erd"]["relationship_depth"] || config[:relationship_depth]
      rescue StandardError
        @output_path = config[:output_path]
        @split_output = config[:split_output]
        @relationship_depth = config[:relationship_depth]
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rails-mermaid_erd_markdown-0.3.2 lib/rails-mermaid_erd_markdown/configuration.rb
rails-mermaid_erd_markdown-0.3.1 lib/rails-mermaid_erd_markdown/configuration.rb
rails-mermaid_erd_markdown-0.3.0 lib/rails-mermaid_erd_markdown/configuration.rb