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
- #airbrake_notify=(bool) ⇒ Object
- #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
#airbrake_notify=(bool) ⇒ Object
34 35 36 37 |
# File 'lib/rapns/configuration.rb', line 34 def airbrake_notify=(bool) Rapns::Deprecation.warn("airbrake_notify is deprecated. Please use the Rapns.reflect API instead.") super(bool) end |
#foreground=(bool) ⇒ Object
51 52 53 54 55 56 57 58 |
# File 'lib/rapns/configuration.rb', line 51 def foreground=(bool) if Rapns.jruby? # The JVM does not support fork(). super(true) else super end end |
#logger=(logger) ⇒ Object
47 48 49 |
# File 'lib/rapns/configuration.rb', line 47 def logger=(logger) super(logger) end |
#on_apns_feedback(&block) ⇒ Object
60 61 62 |
# File 'lib/rapns/configuration.rb', line 60 def on_apns_feedback(&block) self.apns_feedback_callback = block end |
#pid_file=(path) ⇒ Object
39 40 41 42 43 44 45 |
# File 'lib/rapns/configuration.rb', line 39 def pid_file=(path) if path && !Pathname.new(path).absolute? super(File.join(Rails.root, path)) else super end end |
#set_defaults ⇒ Object
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/rapns/configuration.rb', line 65 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 Rapns::Deprecation.muted { 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 self.batch_storage_updates = true # 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 |