Class: Csv2hash::TypeCoercer

Inherits:
Struct
  • Object
show all
Defined in:
lib/csv2hash/coercers/type_coercer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#dataObject

Returns the value of attribute data

Returns:

  • (Object)

    the current value of data



2
3
4
# File 'lib/csv2hash/coercers/type_coercer.rb', line 2

def data
  @data
end

Instance Method Details

#deserialize!Object



4
5
6
7
8
9
10
11
12
13
# File 'lib/csv2hash/coercers/type_coercer.rb', line 4

def deserialize!
  data.each do |line|
    line.each do |key, value|
      _value = value.to_s.strip.downcase
      change.each do |keys, v|
        line[key] = v if keys.include?(_value)
      end
    end
  end
end