Module: Rpush::Daemon::ServiceConfigMethods

Included in:
Adm, Apns, Gcm, Wpns
Defined in:
lib/rpush/daemon/service_config_methods.rb

Constant Summary collapse

DISPATCHERS =
{
  :http => Rpush::Daemon::Dispatcher::Http,
  :tcp => Rpush::Daemon::Dispatcher::Tcp
}

Instance Method Summary collapse

Instance Method Details

#delivery_classObject



18
19
20
# File 'lib/rpush/daemon/service_config_methods.rb', line 18

def delivery_class
  const_get('Delivery')
end

#dispatcher(name = nil, options = {}) ⇒ Object



9
10
11
12
# File 'lib/rpush/daemon/service_config_methods.rb', line 9

def dispatcher(name = nil, options = {})
  @dispatcher_name = name
  @dispatcher_options = options
end

#dispatcher_classObject



14
15
16
# File 'lib/rpush/daemon/service_config_methods.rb', line 14

def dispatcher_class
  DISPATCHERS[@dispatcher_name] || (raise NotImplementedError)
end

#loops(*loops) ⇒ Object



26
27
28
29
30
# File 'lib/rpush/daemon/service_config_methods.rb', line 26

def loops(*loops)
  @loops ||= []
  @loops = loops if loops.any?
  @loops
end

#new_dispatcher(app) ⇒ Object



22
23
24
# File 'lib/rpush/daemon/service_config_methods.rb', line 22

def new_dispatcher(app)
  dispatcher_class.new(app, delivery_class, @dispatcher_options)
end