Class: DataTaster::Collection

Inherits:
Object
  • Object
show all
Defined in:
lib/data_taster/collection.rb

Overview

Ingests the processed yml file and returns either an empty hash (for cases that are skippable) or a hash that contains: select: (whatever is configured to go in the SELECT .. WHERE clause) sanitize: the columns and values that need custom sanitization

Instance Method Summary collapse

Constructor Details

#initialize(table_name) ⇒ Collection

Returns a new instance of Collection.



12
13
14
15
16
# File 'lib/data_taster/collection.rb', line 12

def initialize(table_name)
  @table_name = table_name
  @ingredients = DataTaster.confection[table_name]
  @include_insert = DataTaster.config.include_insert
end

Instance Method Details

#assembleObject



18
19
20
21
22
23
24
25
26
27
# File 'lib/data_taster/collection.rb', line 18

def assemble
  DataTaster.logger.info("#{table_name}...")

  if skippable?
    DataTaster.logger.info("configured to skip both schema and data")
    {}
  else
    { select: selection, sanitize: sanitization }
  end
end