Class: ObserverCallback

Inherits:
Object
  • Object
show all
Defined in:
lib/a-commons.rb

Direct Known Subclasses

ObserverCallbackContract

Instance Method Summary collapse

Constructor Details

#initialize(_publisher, _subscriber, _method_update_to_call = :update) ⇒ ObserverCallback

Returns a new instance of ObserverCallback.



504
505
506
507
508
509
# File 'lib/a-commons.rb', line 504

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



510
511
512
# File 'lib/a-commons.rb', line 510

def update(*args)
  @subscriber.send(@method,*args)
end