Module: ActiveRecordCSVImporter::Dsl

Included in:
Configurator
Defined in:
lib/activerecord_csv_importer/dsl.rb

Overview

This Dsl extends a class that includes ActiveRecordCSVImporter It is a thin proxy to the Config object

Instance Method Summary collapse

Instance Method Details

#batch_size(size) ⇒ Object



17
18
19
# File 'lib/activerecord_csv_importer/dsl.rb', line 17

def batch_size(size)
  config.batch_size = size
end

#column(name, options = {}) ⇒ Object



9
10
11
# File 'lib/activerecord_csv_importer/dsl.rb', line 9

def column(name, options = {})
  config.column_definitions << options.merge(name: name)
end

#each_batch(&block) ⇒ Object



21
22
23
# File 'lib/activerecord_csv_importer/dsl.rb', line 21

def each_batch(&block)
  config.each_batch(block)
end

#model(model_klass) ⇒ Object



5
6
7
# File 'lib/activerecord_csv_importer/dsl.rb', line 5

def model(model_klass)
  config.model = model_klass
end

#on_duplicate_key(options) ⇒ Object



13
14
15
# File 'lib/activerecord_csv_importer/dsl.rb', line 13

def on_duplicate_key(options)
  config.on_duplicate_key = options
end