Ruby Event Handlers: Improved Object Model

Posted on Posted in Uncategorized

I’ve been cleaning up the implementation of Unobservable so that it better adheres to Ruby’s object model.  As a result, the following features are now available:

Singleton Events

It is possible to define singleton events on an object now.  This could be useful if you have a “one off” object and don’t feel like defining an entire class just for the one object:

Easier Event Querying

It’s much easier to figure out which Events were explicitly defined by a Class / Module, and which were inherited by other means:

Method Creation is Optional

Unobservable no longer forces you to create a Method for each Event:

Closing Remarks

Unobservable is getting closer to an official “1.0.0” release.  Some tasks that still remain:

  • Allowing developers to un-define events
  • Adding support for “Event Missing”
  • Adding basic query methods (ex:  “event_defined?” )

You can find more information about the library using the links below:

Leave a Reply

Your email address will not be published. Required fields are marked *