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