Class: Pushr::Daemon::Apns
- Inherits:
-
Object
- Object
- Pushr::Daemon::Apns
- Defined in:
- lib/pushr/daemon/apns.rb
Instance Attribute Summary collapse
-
#configuration ⇒ Object
Returns the value of attribute configuration.
-
#handlers ⇒ Object
Returns the value of attribute handlers.
Instance Method Summary collapse
-
#initialize(options) ⇒ Apns
constructor
A new instance of Apns.
- #start ⇒ Object
- #stop ⇒ Object
Constructor Details
#initialize(options) ⇒ Apns
Returns a new instance of Apns.
6 7 8 9 |
# File 'lib/pushr/daemon/apns.rb', line 6 def initialize() @configuration = @handlers = [] end |
Instance Attribute Details
#configuration ⇒ Object
Returns the value of attribute configuration.
4 5 6 |
# File 'lib/pushr/daemon/apns.rb', line 4 def configuration @configuration end |
#handlers ⇒ Object
Returns the value of attribute handlers.
4 5 6 |
# File 'lib/pushr/daemon/apns.rb', line 4 def handlers @handlers end |
Instance Method Details
#start ⇒ Object
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/pushr/daemon/apns.rb', line 11 def start configuration.connections.times do |i| connection = ApnsSupport::ConnectionApns.new(configuration, i + 1) connection.connect handler = MessageHandler.new("pushr:#{configuration.key}", connection, configuration.app, i + 1) handler.start @handlers << handler end end |
#stop ⇒ Object
22 23 24 |
# File 'lib/pushr/daemon/apns.rb', line 22 def stop @handlers.map(&:stop) end |