Class: NdrImport::NonTabular::Mapping

Inherits:
Table
  • Object
show all
Defined in:
lib/ndr_import/non_tabular/mapping.rb

Overview

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

Constant Summary

Constants inherited from Table

Table::NON_TABULAR_OPTIONS, Table::TABULAR_ONLY_OPTIONS

Instance Attribute Summary

Attributes inherited from Table

#non_tabular_lines

Attributes inherited from Table

#notifier

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Table

#footer_lines, #header_lines, #tablename_pattern=, #transform, #validate_header, #validate_presence_of_start_line_pattern

Methods inherited from Table

#all_valid_options, #encode_with, #header_valid?, #match, #process_line, #transform, #transform_line

Constructor Details

#initialize(options) ⇒ Mapping

Returns a new instance of Mapping.



12
13
14
15
16
17
18
19
20
21
22
23
# 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

Class Method Details

.all_valid_optionsObject



8
9
10
# File 'lib/ndr_import/non_tabular/mapping.rb', line 8

def self.all_valid_options
  super + %w(non_tabular_row)
end