Class: MasterDataTool::Import::Config

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

Constant Summary collapse

DEFAULT_VALUES =
{
  only_tables: [],
  except_tables: [],
  skip_no_change: true,
  ignore_foreign_key_when_delete: true,
}

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(only_tables:, except_tables:, skip_no_change:, ignore_foreign_key_when_delete:) ⇒ Config

Returns a new instance of Config.



13
14
15
16
17
18
# File 'lib/master_data_tool/import/config.rb', line 13

def initialize(only_tables:, except_tables:, skip_no_change:, ignore_foreign_key_when_delete:)
  @only_tables = only_tables
  @except_tables = except_tables
  @skip_no_change = skip_no_change
  @ignore_foreign_key_when_delete = ignore_foreign_key_when_delete
end

Instance Attribute Details

#except_tablesObject

Returns the value of attribute except_tables.



11
12
13
# File 'lib/master_data_tool/import/config.rb', line 11

def except_tables
  @except_tables
end

#ignore_foreign_key_when_deleteObject

Returns the value of attribute ignore_foreign_key_when_delete.



11
12
13
# File 'lib/master_data_tool/import/config.rb', line 11

def ignore_foreign_key_when_delete
  @ignore_foreign_key_when_delete
end

#only_tablesObject

Returns the value of attribute only_tables.



11
12
13
# File 'lib/master_data_tool/import/config.rb', line 11

def only_tables
  @only_tables
end

#skip_no_changeObject

Returns the value of attribute skip_no_change.



11
12
13
# File 'lib/master_data_tool/import/config.rb', line 11

def skip_no_change
  @skip_no_change
end

Class Method Details

.default_configObject



29
30
31
# File 'lib/master_data_tool/import/config.rb', line 29

def default_config
  new(**DEFAULT_VALUES)
end

Instance Method Details

#configure {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:



24
25
26
# File 'lib/master_data_tool/import/config.rb', line 24

def configure
  yield self
end

#skip_table?(table_name) ⇒ Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/master_data_tool/import/config.rb', line 20

def skip_table?(table_name)
  MasterDataTool.need_skip_table?(table_name, only_tables, except_tables)
end