Class: CsvRecord::Field

Inherits:
Object show all
Defined in:
lib/csv_record/field.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#doppelgangerObject (readonly)

Returns the value of attribute doppelganger.



2
3
4
# File 'lib/csv_record/field.rb', line 2

def doppelganger
  @doppelganger
end

#nameObject (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

Returns:

  • (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_sObject



13
14
15
# File 'lib/csv_record/field.rb', line 13

def to_s
  self.name.to_s
end