Class: LimitedObserver

Inherits:
SimpleObserver show all
Defined in:
lib/rui/observer_utils.rb

Instance Method Summary collapse

Constructor Details

#initialize(observed, event, &blk) ⇒ LimitedObserver

Returns a new instance of LimitedObserver.



168
169
170
171
# File 'lib/rui/observer_utils.rb', line 168

def initialize(observed, event, &blk)
  super(event, &blk)
  @observed = observed
end

Instance Method Details

#update(data) ⇒ Object



173
174
175
176
177
# File 'lib/rui/observer_utils.rb', line 173

def update(data)
  remove = super(data)
  @observed.delete_observer(self) if remove
  remove
end