I'm trying to use a priorityQueue from https://github.com/ldonnet/priority_queue on ruby, after installing it with gem install priority_queue
, i'm having the error :
./example.rb:5:in `<main>': undefined method `push' for #<PriorityQueue:0x000000015ca200 @queues={}> (NoMethodError)
When trying to run an example of the README.md file :
#!/usr/bin/ruby
require 'priority_queue'
q = PriorityQueue.new
q.push "node1", 0
q.push "node2", 1
q.min #=> "node1"
q.decrease_priority("node2", -1)
q.pop_min #=> "node2"
q.min #=> "node1"
ruby version : ruby 1.9.3p484 (2013-11-22 revision 43786) [x86_64-linux]
Thank you
The gem you linked do is (a fork of) the PriorityQueue
gem, not the priority_queue
gem. You need gem install PriorityQueue
.
I realize that the repository you linked to says gem install priority_queue
in the readme, but, that does not appear to be correct. The priority_queue
gem is from a different repository.