Class: Eventception::PriorityListeners
- Inherits:
-
Object
- Object
- Eventception::PriorityListeners
- Includes:
- Enumerable
- Defined in:
- lib/eventception/priority_listeners.rb
Instance Attribute Summary collapse
-
#priority ⇒ Object
readonly
Returns the value of attribute priority.
Instance Method Summary collapse
- #<<(listener) ⇒ Object
- #<=>(other) ⇒ Object
- #count ⇒ Object
- #delete(listener) ⇒ Object
- #each(&block) ⇒ Object
- #empty? ⇒ Boolean
-
#initialize(priority:) ⇒ PriorityListeners
constructor
A new instance of PriorityListeners.
- #size ⇒ Object
Constructor Details
#initialize(priority:) ⇒ PriorityListeners
Returns a new instance of PriorityListeners.
13 14 15 16 |
# File 'lib/eventception/priority_listeners.rb', line 13 def initialize(priority:) @priority = priority @listeners = [] end |
Instance Attribute Details
#priority ⇒ Object (readonly)
Returns the value of attribute priority.
11 12 13 |
# File 'lib/eventception/priority_listeners.rb', line 11 def priority @priority end |
Instance Method Details
#<<(listener) ⇒ Object
18 19 20 |
# File 'lib/eventception/priority_listeners.rb', line 18 def <<(listener) listeners << listener end |
#<=>(other) ⇒ Object
22 23 24 |
# File 'lib/eventception/priority_listeners.rb', line 22 def <=>(other) other.priority <=> priority end |
#count ⇒ Object
38 39 40 |
# File 'lib/eventception/priority_listeners.rb', line 38 def count size end |
#delete(listener) ⇒ Object
26 27 28 |
# File 'lib/eventception/priority_listeners.rb', line 26 def delete(listener) listeners.delete(listener) end |
#each(&block) ⇒ Object
30 31 32 |
# File 'lib/eventception/priority_listeners.rb', line 30 def each(&block) listeners.each(&block) end |
#empty? ⇒ Boolean
42 43 44 |
# File 'lib/eventception/priority_listeners.rb', line 42 def empty? listeners.empty? end |
#size ⇒ Object
34 35 36 |
# File 'lib/eventception/priority_listeners.rb', line 34 def size listeners.size end |