Class: Massive::Notifiers::Base

Inherits:
Object
  • Object
show all
Includes:
Locking
Defined in:
lib/massive/notifiers/base.rb

Direct Known Subclasses

Pusher

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Locking

#locked?

Constructor Details

#initialize(id, options = {}) ⇒ Base

Returns a new instance of Base.



8
9
10
11
12
13
# File 'lib/massive/notifiers/base.rb', line 8

def initialize(id, options={})
  self.id   = id
  self.last = {}

  self.options = options || {}
end

Instance Attribute Details

#idObject

Returns the value of attribute id.



6
7
8
# File 'lib/massive/notifiers/base.rb', line 6

def id
  @id
end

#lastObject

Returns the value of attribute last.



6
7
8
# File 'lib/massive/notifiers/base.rb', line 6

def last
  @last
end

#optionsObject

Returns the value of attribute options.



6
7
8
# File 'lib/massive/notifiers/base.rb', line 6

def options
  @options
end

Instance Method Details

#notify(message, data = nil, &block) ⇒ Object



15
16
17
# File 'lib/massive/notifiers/base.rb', line 15

def notify(message, data=nil, &block)
  send_notification(message, data, &block) unless locked?(message, expiration)
end