Sha256: 30b17066793cb7f199852687781f96454e3bbbe44d57f99c4951e2e6d4f7467e

Contents?: true

Size: 1008 Bytes

Versions: 36

Compression:

Stored size: 1008 Bytes

Contents

require 'ndr_import/table'

module NdrImport
  module FixedWidth
    # This class maintains the state of a fixed width table mapping and encapsulates
    # the logic required to transform a table of data into "records". Particular
    # attention has been made to use enumerables throughout to help with the
    # transformation of large quantities of data.
    class Table < ::NdrImport::Table
      # This method transforms an incoming line of fixed wwidrh data by applying
      # each of the klass masked mappings to the line and yielding the klass
      # and fields for each mapped klass.
      def transform_line(line, index)
        return enum_for(:transform_line, line, index) unless block_given?

        masked_mappings.each do |klass, klass_mappings|
          line = fixed_width_columns(line, klass_mappings)
          fields = mapped_line(line, klass_mappings)
          next if fields[:skip].to_s == 'true'.freeze
          yield(klass, fields, index)
        end
      end
    end
  end
end

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
ndr_import-11.2.1 lib/ndr_import/fixed_width/table.rb
ndr_import-11.2.0 lib/ndr_import/fixed_width/table.rb
ndr_import-11.1.0 lib/ndr_import/fixed_width/table.rb
ndr_import-11.0.2 lib/ndr_import/fixed_width/table.rb
ndr_import-11.0.1 lib/ndr_import/fixed_width/table.rb
ndr_import-11.0.0 lib/ndr_import/fixed_width/table.rb
ndr_import-10.3.0 lib/ndr_import/fixed_width/table.rb
ndr_import-10.2.0 lib/ndr_import/fixed_width/table.rb
ndr_import-10.1.3 lib/ndr_import/fixed_width/table.rb
ndr_import-10.1.2 lib/ndr_import/fixed_width/table.rb
ndr_import-10.1.1 lib/ndr_import/fixed_width/table.rb
ndr_import-10.1 lib/ndr_import/fixed_width/table.rb
ndr_import-10.0 lib/ndr_import/fixed_width/table.rb
ndr_import-9.1.0 lib/ndr_import/fixed_width/table.rb
ndr_import-9.0.3 lib/ndr_import/fixed_width/table.rb
ndr_import-9.0.2 lib/ndr_import/fixed_width/table.rb
ndr_import-9.0.1 lib/ndr_import/fixed_width/table.rb
ndr_import-9.0.0 lib/ndr_import/fixed_width/table.rb
ndr_import-8.6.0 lib/ndr_import/fixed_width/table.rb
ndr_import-8.5.2 lib/ndr_import/fixed_width/table.rb