Class: SimpleObserver
Direct Known Subclasses
Instance Method Summary collapse
-
#initialize(event, &blk) ⇒ SimpleObserver
constructor
A new instance of SimpleObserver.
- #update(data) ⇒ Object
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 |