Class: Rapns::Daemon::DeliveryHandlerCollection

Inherits:
Object
  • Object
show all
Defined in:
lib/rapns/daemon/delivery_handler_collection.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeDeliveryHandlerCollection

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

#handlersObject (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

#popObject



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

#sizeObject



22
23
24
# File 'lib/rapns/daemon/delivery_handler_collection.rb', line 22

def size
  @handlers.size
end

#stopObject



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