class Rpush::Configuration

Public Class Methods

new() click to toggle source
Calls superclass method
# File lib/rpush/configuration.rb, line 45
def initialize
  super

  self.push_poll = 2
  self.batch_size = 100
  self.logger = nil
  self.log_file = 'log/rpush.log'
  self.pid_file = 'tmp/rpush.pid'
  self.log_level = (defined?(Rails) && Rails.logger) ? Rails.logger.level : ::Logger::Severity::DEBUG
  self.plugin = OpenStruct.new
  self.foreground = false

  self.apns = ApnsConfiguration.new

  # Internal options.
  self.embedded = false
  self.push = false
end

Public Instance Methods

client=(client) click to toggle source
Calls superclass method
# File lib/rpush/configuration.rb, line 91
def client=(client)
  super
  initialize_client
end
initialize_client() click to toggle source
# File lib/rpush/configuration.rb, line 100
def initialize_client
  return if @client_initialized
  raise ConfigurationError, 'Rpush.config.client is not set.' unless client
  require "rpush/client/#{client}"

  client_module = Rpush::Client.const_get(client.to_s.camelize)
  Rpush.send(:include, client_module) unless Rpush.ancestors.include?(client_module)

  [:Apns, :Gcm, :Wpns, :Wns, :Adm, :Pushy].each do |service|
    Rpush.const_set(service, client_module.const_get(service)) unless Rpush.const_defined?(service)
  end

  @client_initialized = true
end
log_file=(path) click to toggle source
Calls superclass method
# File lib/rpush/configuration.rb, line 79
def log_file=(path)
  if path && !Pathname.new(path).absolute?
    super(File.join(Rpush.root, path))
  else
    super
  end
end
logger=(logger) click to toggle source
Calls superclass method
# File lib/rpush/configuration.rb, line 87
def logger=(logger)
  super(logger)
end
pid_file=(path) click to toggle source
Calls superclass method
# File lib/rpush/configuration.rb, line 71
def pid_file=(path)
  if path && !Pathname.new(path).absolute?
    super(File.join(Rpush.root, path))
  else
    super
  end
end
redis_options=(options) click to toggle source
# File lib/rpush/configuration.rb, line 96
def redis_options=(options)
  Modis.redis_options = options if client == :redis
end
update(other) click to toggle source
# File lib/rpush/configuration.rb, line 64
def update(other)
  CONFIG_ATTRS.each do |attr|
    other_value = other.send(attr)
    send("#{attr}=", other_value) unless other_value.nil?
  end
end