Class: Rapns::Configuration
- Inherits:
-
Struct
- Object
- Struct
- Rapns::Configuration
- Includes:
- Deprecatable
- Defined in:
- lib/rapns/configuration.rb
Instance Attribute Summary collapse
-
#apns_feedback_callback ⇒ Object
Returns the value of attribute apns_feedback_callback.
Instance Method Summary collapse
- #foreground=(bool) ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #logger=(logger) ⇒ Object
- #on_apns_feedback(&block) ⇒ Object
- #pid_file=(path) ⇒ Object
- #set_defaults ⇒ Object
- #update(other) ⇒ Object
Methods included from Deprecatable
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
22 23 24 25 |
# File 'lib/rapns/configuration.rb', line 22 def initialize super set_defaults end |
Instance Attribute Details
#apns_feedback_callback ⇒ Object
Returns the value of attribute apns_feedback_callback.
20 21 22 |
# File 'lib/rapns/configuration.rb', line 20 def apns_feedback_callback @apns_feedback_callback end |
Instance Method Details
#foreground=(bool) ⇒ Object
46 47 48 49 50 51 52 53 |
# File 'lib/rapns/configuration.rb', line 46 def foreground=(bool) if Rapns.jruby? # The JVM does not support fork(). super(true) else super end end |
#logger=(logger) ⇒ Object
42 43 44 |
# File 'lib/rapns/configuration.rb', line 42 def logger=(logger) super(logger) end |
#on_apns_feedback(&block) ⇒ Object
55 56 57 |
# File 'lib/rapns/configuration.rb', line 55 def on_apns_feedback(&block) self.apns_feedback_callback = block end |
#pid_file=(path) ⇒ Object
34 35 36 37 38 39 40 |
# File 'lib/rapns/configuration.rb', line 34 def pid_file=(path) if path && !Pathname.new(path).absolute? super(File.join(Rails.root, path)) else super end end |
#set_defaults ⇒ Object
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/rapns/configuration.rb', line 60 def set_defaults if Rapns.jruby? # The JVM does not support fork(). self.foreground = true else self.foreground = false end self.push_poll = 2 self.feedback_poll = 60 self.airbrake_notify = true self.check_for_errors = true self.batch_size = 5000 self.pid_file = nil self.apns_feedback_callback = nil self.store = :active_record self.logger = nil # Internal options. self. = false self.push = false end |
#update(other) ⇒ Object
27 28 29 30 31 32 |
# File 'lib/rapns/configuration.rb', line 27 def update(other) CONFIG_ATTRS.each do |attr| other_value = other.send(attr) send("#{attr}=", other_value) unless other_value.nil? end end |