Class: DumpCleaner::Config::CleanupTableConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/dump_cleaner/config.rb

Instance Method Summary collapse

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

#columnsObject



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

#dbObject



80
81
82
# File 'lib/dump_cleaner/config.rb', line 80

def db
  @cleanup_table_config["db"]
end

#id_columnObject



88
89
90
# File 'lib/dump_cleaner/config.rb', line 88

def id_column
  @cleanup_table_config["id_column"] || "id"
end

#keep_same_record_conditionsObject



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_columnsObject



98
99
100
# File 'lib/dump_cleaner/config.rb', line 98

def record_context_columns
  @cleanup_table_config["record_context_columns"] || ["id"]
end

#tableObject



84
85
86
# File 'lib/dump_cleaner/config.rb', line 84

def table
  @cleanup_table_config["table"]
end