Class: Rx::PriorityQueue::IndexedItem
- Inherits:
-
Object
- Object
- Rx::PriorityQueue::IndexedItem
- Includes:
- Comparable
- Defined in:
- lib/rx/internal/priority_queue.rb
Constant Summary collapse
- @@length =
0
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
-
#initialize(value) ⇒ IndexedItem
constructor
A new instance of IndexedItem.
Constructor Details
#initialize(value) ⇒ IndexedItem
Returns a new instance of IndexedItem.
107 108 109 110 |
# File 'lib/rx/internal/priority_queue.rb', line 107 def initialize(value) @id = @@length += 1 @value = value end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
103 104 105 |
# File 'lib/rx/internal/priority_queue.rb', line 103 def id @id end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
103 104 105 |
# File 'lib/rx/internal/priority_queue.rb', line 103 def value @value end |
Instance Method Details
#<=>(other) ⇒ Object
112 113 114 115 116 117 118 |
# File 'lib/rx/internal/priority_queue.rb', line 112 def <=>(other) if @value == other.value @id <=> other.id else @value <=> other.value end end |