Sha256: 0dbb1c41f5ee040f635c7b6d316c145f657eb084c4c86e7bca8b0ee8350c71e3

Contents?: true

Size: 595 Bytes

Versions: 3

Compression:

Stored size: 595 Bytes

Contents

module CSVImporter
  # The configuration of a CSVImporter
  class Config
    include Virtus.model

    attribute :model
    attribute :column_definitions, Array[ColumnDefinition], default: proc { [] }
    attribute :identifiers, Array[Symbol], default: []
    attribute :when_invalid, Symbol, default: proc { :skip }
    attribute :after_build_blocks, Array[Proc], default: []
    attribute :after_save_blocks, Array[Proc], default: []

    def after_build(block)
      self.after_build_blocks << block
    end

    def after_save(block)
      self.after_save_blocks << block
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
csv-importer-0.3.1 lib/csv_importer/config.rb
csv-importer-0.3.0 lib/csv_importer/config.rb
csv-importer-0.2.0 lib/csv_importer/config.rb