Module: CsvRowModel::Model::Base

Extended by:
ActiveSupport::Concern
Included in:
CsvRowModel::Model
Defined in:
lib/csv_row_model/concerns/model/base.rb

Instance Method Summary collapse

Instance Method Details

#abort?Boolean

Safe to override.

Returns:

  • (Boolean)

    returns true, if the entire csv file should stop reading


27
28
29
# File 'lib/csv_row_model/concerns/model/base.rb', line 27

def abort?
  false
end

#initialize(options = {}) ⇒ Object

Parameters:

  • options (Hash) (defaults to: {})

Options Hash (options):

  • :parent (String)

    if the instance is a child, pass the parent

  • :context (Hash)

    extra data you want to work with the model


13
14
15
16
17
# File 'lib/csv_row_model/concerns/model/base.rb', line 13

def initialize(options={})
  @initialized_at = DateTime.now
  @parent = options[:parent]
  @context =  OpenStruct.new(options[:context] || {})
end

#skip?Boolean

Safe to override.

Returns:

  • (Boolean)

    returns true, if this instance should be skipped


21
22
23
# File 'lib/csv_row_model/concerns/model/base.rb', line 21

def skip?
  !valid?
end