Class: ReactiveObservers::Observable::Notification
- Inherits:
-
Object
- Object
- ReactiveObservers::Observable::Notification
- Defined in:
- lib/reactive_observers/observable/notification.rb
Instance Method Summary collapse
-
#initialize(observed_object, observers, action, options) ⇒ Notification
constructor
A new instance of Notification.
- #perform ⇒ Object
Constructor Details
#initialize(observed_object, observers, action, options) ⇒ Notification
Returns a new instance of Notification.
8 9 10 11 12 13 |
# File 'lib/reactive_observers/observable/notification.rb', line 8 def initialize(observed_object, observers, action, ) @observed_object = observed_object @observers = observers @action = action @options = end |
Instance Method Details
#perform ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/reactive_observers/observable/notification.rb', line 15 def perform filter_observers.each do |observer| process observer, @observed_object if @action == :update && observer.trigger_with_previous_values process observer, @observed_object.clone.assign_attributes(@options[:diff]) end end end |