Class: DumpCleaner::Config::CleanupTableConfig
- Inherits:
-
Object
- Object
- DumpCleaner::Config::CleanupTableConfig
- Defined in:
- lib/dump_cleaner/config.rb
Instance Method Summary collapse
- #columns ⇒ Object
- #db ⇒ Object
- #id_column ⇒ Object
-
#initialize(cleanup_table_config) ⇒ CleanupTableConfig
constructor
A new instance of CleanupTableConfig.
- #keep_same_record_conditions ⇒ Object
- #record_context_columns ⇒ Object
- #table ⇒ Object
Constructor Details
#initialize(cleanup_table_config) ⇒ CleanupTableConfig
Returns a new instance of CleanupTableConfig.
76 77 78 |
# File 'lib/dump_cleaner/config.rb', line 76 def initialize(cleanup_table_config) @cleanup_table_config = cleanup_table_config end |
Instance Method Details
#columns ⇒ Object
92 93 94 95 96 |
# File 'lib/dump_cleaner/config.rb', line 92 def columns @columns ||= Array(@cleanup_table_config["columns"]).map do CleanupTableColumnConfig.new(name: _1["name"], cleanup_type: _1["cleanup_type"], unique: _1["unique"] == true) end end |
#db ⇒ Object
80 81 82 |
# File 'lib/dump_cleaner/config.rb', line 80 def db @cleanup_table_config["db"] end |
#id_column ⇒ Object
88 89 90 |
# File 'lib/dump_cleaner/config.rb', line 88 def id_column @cleanup_table_config["id_column"] || "id" end |
#keep_same_record_conditions ⇒ Object
102 103 104 105 106 |
# File 'lib/dump_cleaner/config.rb', line 102 def keep_same_record_conditions @keep_same_record_conditions ||= Array(@cleanup_table_config["keep_same_record_conditions"]).map do ConditionConfig.new(condition: _1["condition"], value: _1["value"], column: _1["column"]) end end |
#record_context_columns ⇒ Object
98 99 100 |
# File 'lib/dump_cleaner/config.rb', line 98 def record_context_columns @cleanup_table_config["record_context_columns"] || ["id"] end |
#table ⇒ Object
84 85 86 |
# File 'lib/dump_cleaner/config.rb', line 84 def table @cleanup_table_config["table"] end |