Module: Wirer::Factory::ClassDSL
Overview
A more convenient form of ClassMixin, this additionally adds some private DSL methods which let you declare your #constructor_dependencies, #setter_dependencies and #provides_features.
The DSL works nicely with respect to subclassing, so you can add extra dependencies or features in a subclass.
Instance Method Summary collapse
- #constructor_dependencies ⇒ Object
- #provides_features ⇒ Object
-
#setter_dependencies(instance = nil) ⇒ Object
the supplied implementation of setter_dependencies does not allow for them varying dependening on the instance passed; if you want to specify setter_dependencies on an instance-sensitive basis you’ll need to override this yourself.
Methods included from ClassMixin
#new_from_dependencies, #provides_class
Methods included from Interface
#curry_with_dependencies, #inject_dependency, #new_from_dependencies, #post_initialize, #provides_class, #wrapped_with
Instance Method Details
#constructor_dependencies ⇒ Object
41 42 43 |
# File 'lib/wirer/factory/class_mixins.rb', line 41 def constructor_dependencies @constructor_dependencies ||= (superclass.is_a?(Factory::Interface) ? superclass.constructor_dependencies.dup : {}) end |
#provides_features ⇒ Object
52 53 54 |
# File 'lib/wirer/factory/class_mixins.rb', line 52 def provides_features @provides_features ||= (superclass.is_a?(Factory::Interface) ? superclass.provides_features.dup : []) end |
#setter_dependencies(instance = nil) ⇒ Object
the supplied implementation of setter_dependencies does not allow for them varying dependening on the instance passed; if you want to specify setter_dependencies on an instance-sensitive basis you’ll need to override this yourself.
48 49 50 |
# File 'lib/wirer/factory/class_mixins.rb', line 48 def setter_dependencies(instance=nil) @setter_dependencies ||= (superclass.is_a?(Factory::Interface) ? superclass.setter_dependencies.dup : {}) end |