Class: ActorSystem::Core::ObservableExample
- Includes:
- ObservableImplementation
- Defined in:
- lib/actor_system/core/observable_implementation.rb
Instance Attribute Summary collapse
-
#counter ⇒ Object
Returns the value of attribute counter.
Instance Method Summary collapse
-
#initialize ⇒ ObservableExample
constructor
A new instance of ObservableExample.
- #tick ⇒ Object
Methods included from ObservableImplementation
#add_observer, #notify_observers, #observers
Constructor Details
#initialize ⇒ ObservableExample
Returns a new instance of ObservableExample.
33 34 35 |
# File 'lib/actor_system/core/observable_implementation.rb', line 33 def initialize self.counter = 0 end |
Instance Attribute Details
#counter ⇒ Object
Returns the value of attribute counter.
31 32 33 |
# File 'lib/actor_system/core/observable_implementation.rb', line 31 def counter @counter end |
Instance Method Details
#tick ⇒ Object
37 38 39 40 |
# File 'lib/actor_system/core/observable_implementation.rb', line 37 def tick self.counter += 1 notify_observers(counter) end |