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
32 33 34 35 |
# File 'lib/eventception/priority_listeners.rb', line 32 def initialize(priority:) @priority = priority @listeners = [] end |
Instance Attribute Details
#priority ⇒ Object (readonly)
Returns the value of attribute priority
30 31 32 |
# File 'lib/eventception/priority_listeners.rb', line 30 def priority @priority end |
Instance Method Details
#<<(listener) ⇒ Object
37 38 39 |
# File 'lib/eventception/priority_listeners.rb', line 37 def <<(listener) listeners << listener end |
#<=>(other) ⇒ Object
41 42 43 |
# File 'lib/eventception/priority_listeners.rb', line 41 def <=>(other) other.priority <=> priority end |
#count ⇒ Object
57 58 59 |
# File 'lib/eventception/priority_listeners.rb', line 57 def count size end |
#delete(listener) ⇒ Object
45 46 47 |
# File 'lib/eventception/priority_listeners.rb', line 45 def delete(listener) listeners.delete(listener) end |
#each(&block) ⇒ Object
49 50 51 |
# File 'lib/eventception/priority_listeners.rb', line 49 def each(&block) listeners.each(&block) end |
#empty? ⇒ Boolean
61 62 63 |
# File 'lib/eventception/priority_listeners.rb', line 61 def empty? listeners.empty? end |
#size ⇒ Object
53 54 55 |
# File 'lib/eventception/priority_listeners.rb', line 53 def size listeners.size end |