Class: Lf::Row

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
lib/lf/row.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(line) ⇒ Row

Returns a new instance of Row.



9
10
11
12
13
14
15
16
17
# File 'lib/lf/row.rb', line 9

def initialize(line)
  if line.is_a?(Hash)
    @raw = line
  else
    @raw = LTSV.parse(line.to_s.chomp)[0]
  end

  super(@raw)
end

Instance Attribute Details

#rawObject (readonly)

Returns the value of attribute raw.



7
8
9
# File 'lib/lf/row.rb', line 7

def raw
  @raw
end

Instance Method Details

#to_s(format = :ltsv) ⇒ Object



19
20
21
# File 'lib/lf/row.rb', line 19

def to_s(format = :ltsv)
  Lf::Formatter[format.to_s.to_sym].format(self)
end