Class: ActorSystem::Core::BasicObserverHash
- Defined in:
- lib/actor_system/core/props.rb
Direct Known Subclasses
Instance Method Summary collapse
- #[](key) ⇒ Object
- #[]=(key, value) ⇒ Object
-
#initialize(values = {}) ⇒ BasicObserverHash
constructor
A new instance of BasicObserverHash.
- #observer_update(value) ⇒ Object
Constructor Details
#initialize(values = {}) ⇒ BasicObserverHash
Returns a new instance of BasicObserverHash.
19 20 21 |
# File 'lib/actor_system/core/props.rb', line 19 def initialize values={} @internal_hash = values end |
Instance Method Details
#[](key) ⇒ Object
23 24 25 |
# File 'lib/actor_system/core/props.rb', line 23 def [](key) @internal_hash[key] end |
#[]=(key, value) ⇒ Object
27 28 29 30 31 32 33 34 35 |
# File 'lib/actor_system/core/props.rb', line 27 def []=(key, value) if @internal_hash[key].nil? p = Prop.new key,value p.add_observer self @internal_hash[key] = p else @internal_hash[key].value = value end end |
#observer_update(value) ⇒ Object
37 38 39 |
# File 'lib/actor_system/core/props.rb', line 37 def observer_update value puts "Received update = #{value}" end |