Class: Okura::Serializer::Matrix::Marshal

Inherits:
Object
  • Object
show all
Defined in:
lib/okura/serializer.rb

Instance Method Summary collapse

Instance Method Details

#compile(input, output) ⇒ Object



281
282
283
284
285
286
287
288
# File 'lib/okura/serializer.rb', line 281

def compile(input,output)
  parser=Okura::Parser::Matrix.new input
  mat=Okura::Matrix.new parser.rid_size,parser.lid_size
  parser.each{|rid,lid,cost|
    mat.set(rid,lid,cost)
  }
  ::Marshal.dump(mat,output)
end

#load(io) ⇒ Object



289
290
291
# File 'lib/okura/serializer.rb', line 289

def load(io)
  ::Marshal.load(io)
end