class CSVUtils::CSVIterator::RowWrapper

Attributes

lineno[RW]

Public Class Methods

create(headers, row, lineno) click to toggle source
# File lib/csv_utils/csv_iterator.rb, line 10
def self.create(headers, row, lineno)
  row_wrapper = RowWrapper[headers.zip(row)]
  row_wrapper.lineno = lineno
  row_wrapper
end

Public Instance Methods

to_pretty_s() click to toggle source
# File lib/csv_utils/csv_iterator.rb, line 16
def to_pretty_s
  reject { |_, v| v.nil? || v.strip.empty? }
    .each_with_index
    .map { |(k, v), idx| sprintf('  %-3d %s: %s', idx+1, k, v) }
    .join("\n") + "\n"
end