Class: Okura::Parser::Matrix
- Inherits:
-
Object
- Object
- Okura::Parser::Matrix
- Includes:
- Base
- Defined in:
- lib/okura/parser.rb
Instance Attribute Summary collapse
-
#lid_size ⇒ Object
readonly
Returns the value of attribute lid_size.
-
#rid_size ⇒ Object
readonly
Returns the value of attribute rid_size.
Instance Method Summary collapse
-
#initialize(io) ⇒ Matrix
constructor
A new instance of Matrix.
- #parse(line) ⇒ Object
Methods included from Base
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_size ⇒ Object (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_size ⇒ Object (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 |