Class: Rpush::Configuration
- Inherits:
-
Struct
- Object
- Struct
- Rpush::Configuration
- Includes:
- Deprecatable
- Defined in:
- lib/rpush/configuration.rb
Overview
rubocop:disable Style/StructInheritance
Instance Method Summary collapse
- #client=(client) ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #initialize_client ⇒ Object
- #log_file=(path) ⇒ Object
- #logger=(logger) ⇒ Object
- #pid_file=(path) ⇒ Object
- #redis_options=(options) ⇒ Object
- #update(other) ⇒ Object
Methods included from Deprecatable
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/rpush/configuration.rb', line 30 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.foreground_logging = true # Internal options. self. = false self.push = false end |
Instance Method Details
#client=(client) ⇒ Object
75 76 77 78 |
# File 'lib/rpush/configuration.rb', line 75 def client=(client) super initialize_client end |
#initialize_client ⇒ Object
84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
# File 'lib/rpush/configuration.rb', line 84 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, :Fcm, :Wpns, :Wns, :Adm, :Pushy, :Webpush].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) ⇒ Object
63 64 65 66 67 68 69 |
# File 'lib/rpush/configuration.rb', line 63 def log_file=(path) if path && !Pathname.new(path).absolute? super(File.join(Rpush.root, path)) else super end end |
#logger=(logger) ⇒ Object
71 72 73 |
# File 'lib/rpush/configuration.rb', line 71 def logger=(logger) super(logger) end |
#pid_file=(path) ⇒ Object
55 56 57 58 59 60 61 |
# File 'lib/rpush/configuration.rb', line 55 def pid_file=(path) if path && !Pathname.new(path).absolute? super(File.join(Rpush.root, path)) else super end end |
#redis_options=(options) ⇒ Object
80 81 82 |
# File 'lib/rpush/configuration.rb', line 80 def () Modis. = if client == :redis end |
#update(other) ⇒ Object
48 49 50 51 52 53 |
# File 'lib/rpush/configuration.rb', line 48 def update(other) CONFIG_ATTRS.each do |attr| other_value = other.send(attr) send("#{attr}=", other_value) unless other_value.nil? end end |