Class: Received::Backend::Base
- Inherits:
-
Object
- Object
- Received::Backend::Base
- Defined in:
- lib/received/backend/base.rb
Direct Known Subclasses
Class Method Summary collapse
- .add_observer(observer) ⇒ Object
- .notify_observers(method, payload) ⇒ Object
- .observers ⇒ Object
- .remove_observer(observer) ⇒ Object
Instance Method Summary collapse
- #notify_observers(*args) ⇒ Object
-
#store(mail) ⇒ Object
abstract
Stores the data.
Class Method Details
.add_observer(observer) ⇒ Object
24 25 26 |
# File 'lib/received/backend/base.rb', line 24 def add_observer(observer) observers.push(observer) end |
.notify_observers(method, payload) ⇒ Object
32 33 34 35 36 37 38 |
# File 'lib/received/backend/base.rb', line 32 def notify_observers(method, payload) observers.each do |observer| if observer.respond_to?(method) observer.send(method, payload) rescue nil end end end |
.observers ⇒ Object
20 21 22 |
# File 'lib/received/backend/base.rb', line 20 def observers @@observers ||= [] end |
.remove_observer(observer) ⇒ Object
28 29 30 |
# File 'lib/received/backend/base.rb', line 28 def remove_observer(observer) observers.delete(observer) end |
Instance Method Details
#notify_observers(*args) ⇒ Object
15 16 17 |
# File 'lib/received/backend/base.rb', line 15 def notify_observers(*args) self.class.notify_observers(*args) end |
#store(mail) ⇒ Object
This method is abstract.
Stores the data
11 12 13 |
# File 'lib/received/backend/base.rb', line 11 def store(mail) raise NotImplementedError end |