Class: Rapns::Daemon::DeliveryHandlerCollection
- Inherits:
-
Object
- Object
- Rapns::Daemon::DeliveryHandlerCollection
- Defined in:
- lib/rapns/daemon/delivery_handler_collection.rb
Instance Attribute Summary collapse
-
#handlers ⇒ Object
readonly
Returns the value of attribute handlers.
Instance Method Summary collapse
-
#initialize ⇒ DeliveryHandlerCollection
constructor
A new instance of DeliveryHandlerCollection.
- #pop ⇒ Object
- #push(handler) ⇒ Object
- #size ⇒ Object
- #stop ⇒ Object
Constructor Details
#initialize ⇒ DeliveryHandlerCollection
Returns a new instance of DeliveryHandlerCollection.
6 7 8 |
# File 'lib/rapns/daemon/delivery_handler_collection.rb', line 6 def initialize @handlers = [] end |
Instance Attribute Details
#handlers ⇒ Object (readonly)
Returns the value of attribute handlers.
4 5 6 |
# File 'lib/rapns/daemon/delivery_handler_collection.rb', line 4 def handlers @handlers end |
Instance Method Details
#pop ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/rapns/daemon/delivery_handler_collection.rb', line 14 def pop handler = @handlers.pop handler.stop handler.wakeup @handlers.map(&:wakeup) handler.wait end |
#push(handler) ⇒ Object
10 11 12 |
# File 'lib/rapns/daemon/delivery_handler_collection.rb', line 10 def push(handler) @handlers << handler end |
#size ⇒ Object
22 23 24 |
# File 'lib/rapns/daemon/delivery_handler_collection.rb', line 22 def size @handlers.size end |
#stop ⇒ Object
26 27 28 29 30 |
# File 'lib/rapns/daemon/delivery_handler_collection.rb', line 26 def stop @handlers.map(&:stop) @handlers.map(&:wakeup) @handlers.map(&:wait) end |