Method: BioDSL::CSV#each_hash

Defined in:
lib/BioDSL/csv.rb

#each_hash(options = {}) ⇒ Object

Method to iterate over a CSV IO object yielding hashes or an enumerator

CSV.each_hash(options={}) { |item| block } -> hash
CSV.each_hash(options={})                  -> Enumerator

Options:

* :delimiter      -
* :select         -
* :reject         -


174
175
176
177
178
179
180
181
182
183
184
185
186
# File 'lib/BioDSL/csv.rb', line 174

def each_hash(options = {})
  each_array(options) do |array|
    hash = {}

    array.convert_types(@types).each_with_index do |field, i|
      hash[@header[i]] = field
    end

    yield hash
  end

  self
end