Class: Notifiable::NotifierBase

Inherits:
Object
  • Object
show all
Defined in:
lib/notifiable/notifier_base.rb

Class Attribute Summary collapse

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(notification) ⇒ NotifierBase

Returns a new instance of NotifierBase.



18
19
20
21
# File 'lib/notifiable/notifier_base.rb', line 18

def initialize(notification)
  @notification = notification
  @mutex = Mutex.new
end

Class Attribute Details

.notifier_attributesObject (readonly)

Returns the value of attribute notifier_attributes.



15
16
17
# File 'lib/notifiable/notifier_base.rb', line 15

def notifier_attributes
  @notifier_attributes
end

Instance Attribute Details

#envObject (readonly)

Returns the value of attribute env.



6
7
8
# File 'lib/notifiable/notifier_base.rb', line 6

def env
  @env
end

#notificationObject (readonly)

Returns the value of attribute notification.



6
7
8
# File 'lib/notifiable/notifier_base.rb', line 6

def notification
  @notification
end

Class Method Details

.notifier_attribute(*vars) ⇒ Object



8
9
10
11
12
# File 'lib/notifiable/notifier_base.rb', line 8

def self.notifier_attribute(*vars)
  @notifier_attributes ||= []
  @notifier_attributes.concat vars
  attr_writer(*vars)
end

Instance Method Details

#closeObject



27
28
29
30
31
# File 'lib/notifiable/notifier_base.rb', line 27

def close
  flush
  save_receipts if Notifiable.save_receipts
  @notification.save
end

#send_notification(device_token) ⇒ Object



23
24
25
# File 'lib/notifiable/notifier_base.rb', line 23

def send_notification(device_token)
 enqueue(device_token, notification)
end