Class: Sidenotes::Configuration
- Inherits:
-
Object
- Object
- Sidenotes::Configuration
- Defined in:
- lib/sidenotes/configuration.rb
Constant Summary collapse
- VALID_FORMATS =
%i[yaml json].freeze
- VALID_SECTIONS =
%i[columns indexes associations foreign_keys check_constraints metadata].freeze
- DEFAULT_SECTIONS =
%i[columns indexes associations foreign_keys metadata].freeze
Instance Attribute Summary collapse
-
#auto_generate_after_migrate ⇒ Object
Returns the value of attribute auto_generate_after_migrate.
-
#exclude_patterns ⇒ Object
Returns the value of attribute exclude_patterns.
-
#format ⇒ Object
Returns the value of attribute format.
-
#model_paths ⇒ Object
Returns the value of attribute model_paths.
-
#output_directory ⇒ Object
Returns the value of attribute output_directory.
-
#sections ⇒ Object
Returns the value of attribute sections.
Instance Method Summary collapse
- #auto_generate_after_migrate? ⇒ Boolean
- #file_extension ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
12 13 14 15 16 17 18 19 |
# File 'lib/sidenotes/configuration.rb', line 12 def initialize @output_directory = '.annotations' @format = :yaml @sections = DEFAULT_SECTIONS.dup @model_paths = ['app/models'] @exclude_patterns = [] @auto_generate_after_migrate = false end |
Instance Attribute Details
#auto_generate_after_migrate ⇒ Object
Returns the value of attribute auto_generate_after_migrate.
10 11 12 |
# File 'lib/sidenotes/configuration.rb', line 10 def auto_generate_after_migrate @auto_generate_after_migrate end |
#exclude_patterns ⇒ Object
Returns the value of attribute exclude_patterns.
10 11 12 |
# File 'lib/sidenotes/configuration.rb', line 10 def exclude_patterns @exclude_patterns end |
#format ⇒ Object
Returns the value of attribute format.
9 10 11 |
# File 'lib/sidenotes/configuration.rb', line 9 def format @format end |
#model_paths ⇒ Object
Returns the value of attribute model_paths.
10 11 12 |
# File 'lib/sidenotes/configuration.rb', line 10 def model_paths @model_paths end |
#output_directory ⇒ Object
Returns the value of attribute output_directory.
9 10 11 |
# File 'lib/sidenotes/configuration.rb', line 9 def output_directory @output_directory end |
#sections ⇒ Object
Returns the value of attribute sections.
9 10 11 |
# File 'lib/sidenotes/configuration.rb', line 9 def sections @sections end |
Instance Method Details
#auto_generate_after_migrate? ⇒ Boolean
21 22 23 |
# File 'lib/sidenotes/configuration.rb', line 21 def auto_generate_after_migrate? auto_generate_after_migrate || ENV['SIDENOTES_AUTO_GENERATE'] == 'true' end |
#file_extension ⇒ Object
53 54 55 56 57 58 59 |
# File 'lib/sidenotes/configuration.rb', line 53 def file_extension case @format when :yaml then 'yml' when :json then 'json' else raise ArgumentError, "Unknown format: #{@format}" end end |