Class: Infusible::Builder
- Inherits:
-
Module
- Object
- Module
- Infusible::Builder
- Defined in:
- lib/infusible/builder.rb
Overview
Provides the automatic and complete resolution of all injected dependencies. :reek:TooManyInstanceVariables
Instance Method Summary collapse
- #included(descendant) ⇒ Object
-
#initialize(container, *configuration, scope: :private) ⇒ Builder
constructor
A new instance of Builder.
Constructor Details
#initialize(container, *configuration, scope: :private) ⇒ Builder
Returns a new instance of Builder.
24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/infusible/builder.rb', line 24 def initialize container, *configuration, scope: :private super() @container = container @dependencies = DependencyMap.new(*configuration) @scope = scope @class_module = Module.new @instance_module = Module.new.set_temporary_name "infusible" freeze end |
Instance Method Details
#included(descendant) ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/infusible/builder.rb', line 36 def included descendant unless descendant.is_a? Class fail TypeError, "Can only infuse a class, invalid object: #{descendant} (#{descendant.class})." end super define descendant descendant.extend class_module descendant.include instance_module end |