Sha256: 17286f971b468d2ecf6ff957fd676b4e890c0871be671986a726d45530d83e40

Contents?: true

Size: 531 Bytes

Versions: 4

Compression:

Stored size: 531 Bytes

Contents

module Csv2hash
  module Discover

    def find_dynamic_position cell
      y, x = cell.rules.fetch :position
      column, matcher = y
      dynamic_y_axe = data_source.index { |entries| entries[column] =~ matcher }

      if dynamic_y_axe.nil?
        if cell.rules.fetch(:allow_blank)
          return nil
        else
          raise "Y doesn't found for #{cell.rules[:position]} on :#{cell.rules.fetch(:key)}"
        end
      else
        cell.rules[:position] = [dynamic_y_axe, x]
        cell
      end
    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
csv2hash-0.6.8 lib/csv2hash/discover.rb
csv2hash-0.6.7 lib/csv2hash/discover.rb
csv2hash-0.6.6 lib/csv2hash/discover.rb
csv2hash-0.6.5 lib/csv2hash/discover.rb