Class: Notifiable::NotifierBase
- Inherits:
-
Object
- Object
- Notifiable::NotifierBase
- Defined in:
- lib/notifiable/notifier_base.rb
Instance Attribute Summary collapse
-
#env ⇒ Object
readonly
Returns the value of attribute env.
-
#notification ⇒ Object
readonly
Returns the value of attribute notification.
Class Method Summary collapse
Instance Method Summary collapse
- #close ⇒ Object
-
#initialize(env, notification) ⇒ NotifierBase
constructor
A new instance of NotifierBase.
- #send_notification(device_token) ⇒ Object
Constructor Details
#initialize(env, notification) ⇒ NotifierBase
Returns a new instance of NotifierBase.
17 18 19 |
# File 'lib/notifiable/notifier_base.rb', line 17 def initialize(env, notification) @env, @notification = env, notification end |
Instance Attribute Details
#env ⇒ Object (readonly)
Returns the value of attribute env.
5 6 7 |
# File 'lib/notifiable/notifier_base.rb', line 5 def env @env end |
#notification ⇒ Object (readonly)
Returns the value of attribute notification.
5 6 7 |
# File 'lib/notifiable/notifier_base.rb', line 5 def notification @notification end |
Class Method Details
.notifier_attribute(*vars) ⇒ Object
7 8 9 10 11 |
# File 'lib/notifiable/notifier_base.rb', line 7 def self.notifier_attribute(*vars) @notifier_attributes ||= [] @notifier_attributes.concat vars attr_writer(*vars) end |
.notifier_attributes ⇒ Object
13 14 15 |
# File 'lib/notifiable/notifier_base.rb', line 13 def self.notifier_attributes @notifier_attributes end |
Instance Method Details
#close ⇒ Object
25 26 27 28 29 |
# File 'lib/notifiable/notifier_base.rb', line 25 def close flush save_receipts if Notifiable.save_receipts @notification.save end |
#send_notification(device_token) ⇒ Object
21 22 23 |
# File 'lib/notifiable/notifier_base.rb', line 21 def send_notification(device_token) enqueue(device_token, self.notification) end |