Class: Hypo::Lifetime::Scope
- Inherits:
-
Object
- Object
- Hypo::Lifetime::Scope
- Defined in:
- lib/hypo/lifetime/scope.rb
Instance Method Summary collapse
Instance Method Details
#instance(component, attrs = nil) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/hypo/lifetime/scope.rb', line 4 def instance(component, attrs = nil) instances = component.scope.instances unless instances.key? component.name if component.respond_to? :type dependencies = attrs ? [attrs].concat(component.dependencies) : component.dependencies instances[component.name] = component.type.new(*dependencies) else instances[component.name] = component.object end end instances[component.name] end |
#purge(scope) ⇒ Object
19 20 21 |
# File 'lib/hypo/lifetime/scope.rb', line 19 def purge(scope) scope.purge end |