SubSetter Pattern implementation for Ruby
As described in SubSetter Pattern for Ruby.
Installation
Not yet
This implementation creates
- The SubSetter Module, containing three methods (and three more aliases) that are included into Object.
- The SubSetter::Object Class, implementation (empty right now) of a generic subsetter for Object.
New methods in Object
Public
subsetter
: returns an instance of the designated subsetter for the class of this instance._subsetter
,by
andfilter
: aliases forsubsetter
.by
andfilter
are added for legibility, and_subsetter
in the remote case that all other method names are overriden, in order to not jeopardize the subsetting functionality
_subsetter
is the recommended form to be used when developing a library on top of the sub-setter gem.
Private
_subsetter_for(Class)
: returns an instance of the designated subsetting class for the givenClass
_has_subsetter_for(Class)
: returns true if for the passed class a corresponding subsetter class exists, false otherwise
License
GPL