Class: Jcsv::Mapping
- Inherits:
-
Object
- Object
- Jcsv::Mapping
- 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
-
#mapping ⇒ Object
Returns the value of attribute mapping.
Instance Method Summary collapse
- #[](index) ⇒ Object
- #[]=(index, value) ⇒ Object
-
#initialize ⇒ Mapping
constructor
A new instance of Mapping.
Constructor Details
#initialize ⇒ Mapping
Returns a new instance of Mapping.
41 42 43 |
# File 'lib/supercsv_interface.rb', line 41 def initialize @mapping = nil end |
Instance Attribute Details
#mapping ⇒ Object
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 |