Implements the Observable design pattern as a mixin so that other objects can be notified of changes in state. See observer.rb for details and an example.
| Public Methods | |
|---|---|
| add_ |
Add observer as an observer on this object. observer will now receive notifications. |
| changed | Set the changed state of this object. Notifications will be sent only if the changed state is true. |
| changed? | Query the changed state of this object. |
| count_ |
Return the number of observers associated with this object. |
| delete_ |
Delete observer as an observer on this object. It will no longer receive notifications. |
| delete_ |
Delete all observers associated with this object. |
| notify_ |
If this object’s changed state is true, invoke the update method in each currently associated observer in turn, passing it the given arguments. The changed state is then set to false. |
<code/>and<pre/>for code samples.