Class: DroppableTable::Config
- Inherits:
-
Object
- Object
- DroppableTable::Config
- Defined in:
- lib/droppable_table/config.rb
Constant Summary collapse
- DEFAULT_CONFIG_FILE =
"droppable_table.yml"- RAILS_INTERNAL_TABLES_FILE =
File.("../../config/rails_internal_tables.yml", __dir__)
- KNOWN_GEMS_FILE =
File.("../../config/known_gems.yml", __dir__)
Instance Attribute Summary collapse
-
#config_file_path ⇒ Object
readonly
Returns the value of attribute config_file_path.
-
#excluded_gems ⇒ Object
readonly
Returns the value of attribute excluded_gems.
-
#excluded_tables ⇒ Object
readonly
Returns the value of attribute excluded_tables.
-
#strict_mode ⇒ Object
readonly
Returns the value of attribute strict_mode.
Instance Method Summary collapse
- #all_excluded_tables ⇒ Object
- #baseline_file ⇒ Object
-
#initialize(config_file_path = nil) ⇒ Config
constructor
A new instance of Config.
- #known_gem_tables ⇒ Object
- #rails_internal_tables ⇒ Object
- #strict_mode_enabled? ⇒ Boolean
Constructor Details
#initialize(config_file_path = nil) ⇒ Config
Returns a new instance of Config.
14 15 16 17 18 19 20 21 22 |
# File 'lib/droppable_table/config.rb', line 14 def initialize(config_file_path = nil) @config_file_path = config_file_path || DEFAULT_CONFIG_FILE @excluded_tables = Set.new @excluded_gems = Set.new @strict_mode = {} load_default_config load_user_config if File.exist?(@config_file_path) end |
Instance Attribute Details
#config_file_path ⇒ Object (readonly)
Returns the value of attribute config_file_path.
12 13 14 |
# File 'lib/droppable_table/config.rb', line 12 def config_file_path @config_file_path end |
#excluded_gems ⇒ Object (readonly)
Returns the value of attribute excluded_gems.
12 13 14 |
# File 'lib/droppable_table/config.rb', line 12 def excluded_gems @excluded_gems end |
#excluded_tables ⇒ Object (readonly)
Returns the value of attribute excluded_tables.
12 13 14 |
# File 'lib/droppable_table/config.rb', line 12 def excluded_tables @excluded_tables end |
#strict_mode ⇒ Object (readonly)
Returns the value of attribute strict_mode.
12 13 14 |
# File 'lib/droppable_table/config.rb', line 12 def strict_mode @strict_mode end |
Instance Method Details
#all_excluded_tables ⇒ Object
32 33 34 |
# File 'lib/droppable_table/config.rb', line 32 def all_excluded_tables Set.new(excluded_tables) + Set.new(rails_internal_tables) + gem_excluded_tables end |
#baseline_file ⇒ Object
40 41 42 |
# File 'lib/droppable_table/config.rb', line 40 def baseline_file strict_mode["baseline_file"] || ".droppable_table_baseline.json" end |
#known_gem_tables ⇒ Object
28 29 30 |
# File 'lib/droppable_table/config.rb', line 28 def known_gem_tables @known_gem_tables ||= load_yaml_file(KNOWN_GEMS_FILE) end |
#rails_internal_tables ⇒ Object
24 25 26 |
# File 'lib/droppable_table/config.rb', line 24 def rails_internal_tables @rails_internal_tables ||= load_yaml_file(RAILS_INTERNAL_TABLES_FILE) end |
#strict_mode_enabled? ⇒ Boolean
36 37 38 |
# File 'lib/droppable_table/config.rb', line 36 def strict_mode_enabled? strict_mode["enabled"] == true end |