Class: Okura::Parser::Matrix

Inherits:
Object
  • Object
show all
Includes:
Base
Defined in:
lib/okura/parser.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Base

#each

Constructor Details

#initialize(io) ⇒ Matrix

Returns a new instance of Matrix.



28
29
30
31
# File 'lib/okura/parser.rb', line 28

def initialize io
  @io=io
  @rid_size,@lid_size=io.readline.split(/\s/).map(&:to_i)
end

Instance Attribute Details

#lid_sizeObject (readonly)

Returns the value of attribute lid_size.



34
35
36
# File 'lib/okura/parser.rb', line 34

def lid_size
  @lid_size
end

#rid_sizeObject (readonly)

Returns the value of attribute rid_size.



33
34
35
# File 'lib/okura/parser.rb', line 33

def rid_size
  @rid_size
end

Instance Method Details

#parse(line) ⇒ Object



36
37
38
39
# File 'lib/okura/parser.rb', line 36

def parse line
  rid,lid,cost=line.split(/\s/).map(&:to_i)
  [rid,lid,cost]
end