module CsvRowModel::Model::Base

Attributes

initialized_at[R]

@return [DateTime] return when self has been intialized

parent[R]

@return [Model] return the parent, if this instance is a child

Public Class Methods

new(source=nil, options={}) click to toggle source

@param [NilClass] source not used here, see {Input} @param [Hash] options @option options [String] :parent if the instance is a child, pass the parent

# File lib/csv_row_model/model/base.rb, line 19
def initialize(source=nil, options={})
  @initialized_at = DateTime.now
  @parent = options[:parent]
end

Public Instance Methods

abort?() click to toggle source

Safe to override.

@return [Boolean] returns true, if the entire csv file should stop reading

# File lib/csv_row_model/model/base.rb, line 34
def abort?
  false
end
csv_string_model(&block) click to toggle source

Called to add validations to the csv_string_model_class

# File lib/csv_row_model/model/base.rb, line 46
def csv_string_model(&block)
  csv_string_model_class.class_eval(&block)
end
csv_string_model_class() click to toggle source

@return [Class] the Class with validations of the csv_string_model

# File lib/csv_row_model/model/base.rb, line 40
def csv_string_model_class
  @csv_string_model_class ||= inherited_custom_class(:csv_string_model_class, CsvStringModel)
end
skip?() click to toggle source

Safe to override.

@return [Boolean] returns true, if this instance should be skipped

# File lib/csv_row_model/model/base.rb, line 27
def skip?
  !valid?
end