depq is a Double-Ended Priority Queue library. It is a data structure which can insert elements and delete elements with minimum and maximum priority. If there are elements which has same priority, the element inserted first is chosen. The priority can be changed after the element is inserted.
Gemfile gem 'depq', '~> 0.4'
install gem install depq -v 0.4