Class: ObserverCallback
- Inherits:
-
Object
- Object
- ObserverCallback
- Defined in:
- lib/a-commons.rb
Direct Known Subclasses
Instance Method Summary collapse
-
#initialize(_publisher, _subscriber, _method_update_to_call = :update) ⇒ ObserverCallback
constructor
A new instance of ObserverCallback.
- #update(*args) ⇒ Object
Constructor Details
#initialize(_publisher, _subscriber, _method_update_to_call = :update) ⇒ ObserverCallback
Returns a new instance of ObserverCallback.
616 617 618 619 620 621 |
# File 'lib/a-commons.rb', line 616 def initialize(_publisher, _subscriber, _method_update_to_call=:update) @publisher = _publisher @subscriber = _subscriber @method=_method_update_to_call @publisher.add_observer(self) end |
Instance Method Details
#update(*args) ⇒ Object
622 623 624 |
# File 'lib/a-commons.rb', line 622 def update(*args) @subscriber.send(@method,*args) end |