Class: CSVUtils::CSVIterator::RowWrapper
- Inherits:
-
Hash
- Object
- Hash
- CSVUtils::CSVIterator::RowWrapper
- Defined in:
- lib/csv_utils/csv_iterator.rb
Instance Attribute Summary collapse
-
#lineno ⇒ Object
Returns the value of attribute lineno.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#lineno ⇒ Object
Returns the value of attribute lineno.
8 9 10 |
# File 'lib/csv_utils/csv_iterator.rb', line 8 def lineno @lineno end |
Class Method Details
.create(headers, row, lineno) ⇒ Object
10 11 12 13 14 |
# 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 |
Instance Method Details
#to_pretty_s ⇒ Object
16 17 18 19 20 21 |
# 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 |