Module: Csv2hash::Discover
- Included in:
- Validator
- Defined in:
- lib/csv2hash/discover.rb
Instance Method Summary (collapse)
Instance Method Details
- (Object) find_positions!
4 5 6 7 8 9 10 11 12 13 |
# File 'lib/csv2hash/discover.rb', line 4 def find_positions! definition.cells.each do |cell| y, x = cell.rules.fetch :position if y.is_a?(Array) column, matcher = y y = data_source.index { |entries| entries[column] =~ matcher } cell.rules[:position] = [y, x] end end end |