Class: CsvRecord::Field
Instance Attribute Summary collapse
-
#doppelganger ⇒ Object
readonly
Returns the value of attribute doppelganger.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(name, doppelganger = nil) ⇒ Field
constructor
A new instance of Field.
- #is?(value) ⇒ Boolean
- #to_s ⇒ Object
Constructor Details
#initialize(name, doppelganger = nil) ⇒ Field
Returns a new instance of Field.
4 5 6 7 |
# File 'lib/csv_record/field.rb', line 4 def initialize(name, doppelganger=nil) @name = name @doppelganger = doppelganger end |
Instance Attribute Details
#doppelganger ⇒ Object (readonly)
Returns the value of attribute doppelganger.
2 3 4 |
# File 'lib/csv_record/field.rb', line 2 def doppelganger @doppelganger end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
2 3 4 |
# File 'lib/csv_record/field.rb', line 2 def name @name end |
Instance Method Details
#is?(value) ⇒ Boolean
17 18 19 20 |
# File 'lib/csv_record/field.rb', line 17 def is?(value) self.doppelganger.to_sym == value.to_sym || self.name.to_sym == value.to_sym end |
#to_s ⇒ Object
13 14 15 |
# File 'lib/csv_record/field.rb', line 13 def to_s self.name.to_s end |