class NdrImport::NonTabular::Mapping

This class stores the mapping used to break an incoming file into multiple rows/records

Public Class Methods

all_valid_options() click to toggle source
Calls superclass method
# File lib/ndr_import/non_tabular/mapping.rb, line 8
def self.all_valid_options
  super + %w(non_tabular_row)
end
new(options) click to toggle source
Calls superclass method
# File lib/ndr_import/non_tabular/mapping.rb, line 12
def initialize(options)
  non_tabular_mappings = options['non_tabular_row']
  if non_tabular_mappings
    initialize_non_tabular_mappings(non_tabular_mappings)
  else
    # validate presence of non_tabular_row
    fail NdrImport::MappingError,
         I18n.t('mapping.errors.missing_non_tabular_row')
  end

  super(options)
end

Private Instance Methods

initialize_non_tabular_mappings(non_tabular_mappings) click to toggle source
# File lib/ndr_import/non_tabular/mapping.rb, line 27
def initialize_non_tabular_mappings(non_tabular_mappings)
  NON_TABULAR_OPTIONS.each do |key|
    next unless non_tabular_mappings[key]
    instance_variable_set("@#{key}", non_tabular_mappings[key])
  end
end