Class: InCSV::Column
- Inherits:
-
Object
- Object
- InCSV::Column
- Defined in:
- lib/incsv/column.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(name, values) ⇒ Column
constructor
A new instance of Column.
- #type ⇒ Object
Constructor Details
#initialize(name, values) ⇒ Column
Returns a new instance of Column.
5 6 7 8 |
# File 'lib/incsv/column.rb', line 5 def initialize(name, values) @name = name @values = values end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
10 11 12 |
# File 'lib/incsv/column.rb', line 10 def name @name end |
Instance Method Details
#type ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/incsv/column.rb', line 12 def type Types.constants.select do |column_type| column_type = Types.const_get(column_type) if values.all? { |value| value.nil? || column_type.new(value).match? } return column_type end end end |