Class: Jcsv::Mapping

Inherits:
Object
  • Object
show all
Defined in:
lib/supercsv_interface.rb

Overview

Mapping contains a mapping from column names to:

* other column names: when we want to change the name of the column
* false: when we want to remove the column from reading
* true: when the column is a dimensions

If there is no mapping then the column number maps to itself

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeMapping

Returns a new instance of Mapping.



41
42
43
# File 'lib/supercsv_interface.rb', line 41

def initialize
  @mapping = nil
end

Instance Attribute Details

#mappingObject

Returns the value of attribute mapping.



39
40
41
# File 'lib/supercsv_interface.rb', line 39

def mapping
  @mapping
end

Instance Method Details

#[](index) ⇒ Object



45
46
47
48
# File 'lib/supercsv_interface.rb', line 45

def [](index)
  # p "#{@mapping}, #{index}"
  (@mapping.nil?)? index : @mapping[index]
end

#[]=(index, value) ⇒ Object



50
51
52
# File 'lib/supercsv_interface.rb', line 50

def []=(index, value)
  @mapping[index] = value
end