Class: Priorityq::PriorityQueue::Element
- Inherits:
-
Object
- Object
- Priorityq::PriorityQueue::Element
- Includes:
- Comparable
- Defined in:
- lib/priorityq/priority_queue.rb
Instance Attribute Summary collapse
-
#priority ⇒ Object
readonly
Returns the value of attribute priority.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
-
#initialize(priority, value) ⇒ Element
constructor
A new instance of Element.
Constructor Details
#initialize(priority, value) ⇒ Element
Returns a new instance of Element.
8 9 10 11 |
# File 'lib/priorityq/priority_queue.rb', line 8 def initialize(priority, value) @priority = priority @value = value end |
Instance Attribute Details
#priority ⇒ Object (readonly)
Returns the value of attribute priority.
6 7 8 |
# File 'lib/priorityq/priority_queue.rb', line 6 def priority @priority end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
6 7 8 |
# File 'lib/priorityq/priority_queue.rb', line 6 def value @value end |
Instance Method Details
#<=>(other) ⇒ Object
13 14 15 |
# File 'lib/priorityq/priority_queue.rb', line 13 def <=>(other) priority <=> other.priority end |