Class: SimpleObserver

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

Direct Known Subclasses

LimitedObserver

Instance Method Summary collapse

Constructor Details

#initialize(event, &blk) ⇒ SimpleObserver

Returns a new instance of SimpleObserver.



155
156
157
158
# File 'lib/rui/observer_utils.rb', line 155

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

Instance Method Details

#update(data) ⇒ Object



160
161
162
163
164
# File 'lib/rui/observer_utils.rb', line 160

def update(data)
  if data.has_key?(@event)
    @blk.generic_call(data[@event])
  end
end