Module: SubSetter
- Included in:
- Object
- Defined in:
- lib/sub-setter/sub-setter.rb
Overview
SubSetter Pattern implementation for Ruby
As described in SubSetter Pattern for Ruby xaviervia.com.ar/patterns/sub-setter
Defined Under Namespace
Classes: Object
Instance Method Summary collapse
-
#subsetter ⇒ Object
(also: #by, #filter, #_subsetter)
Gets the subsetter for self.
Instance Method Details
#subsetter ⇒ Object Also known as: by, filter, _subsetter
Gets the subsetter for self
The default behaviour is, for class Klass, to look for a class named SubSetter::Klass; for a class Library::Klass, a class named SubSetter::Library::Klass, following the criteria described in xaviervia.com.ar/patterns/sub-setter
If a SubSetter for the current class is not found, a SubSetter for the superclass is searched instead, and if is not found in that class, further in the class hierarchy until a SubSetter is found.
16 17 18 |
# File 'lib/sub-setter/sub-setter.rb', line 16 def subsetter _subsetter_for(self.class).new self end |