Class: Scorpion::Dependency::BuilderDependency
- Inherits:
-
Scorpion::Dependency
- Object
- Scorpion::Dependency
- Scorpion::Dependency::BuilderDependency
- Defined in:
- lib/scorpion/dependency/builder_dependency.rb
Overview
Scorpion::Dependency that delegates to another object that implements #call( scorpion, *args, &block ).
Attributes collapse
-
#builder ⇒ #call(scorpion,*args,&block)
The builder to use to fetch instances of the dependency.
Attributes inherited from Scorpion::Dependency
Instance Method Summary collapse
- #fetch(hunt) ⇒ Object
-
#initialize(contract, builder = nil, &block) ⇒ BuilderDependency
constructor
A new instance of BuilderDependency.
Methods inherited from Scorpion::Dependency
#==, define, #hash, #inspect, #release, #replicate, #satisfies?
Constructor Details
#initialize(contract, builder = nil, &block) ⇒ BuilderDependency
Returns a new instance of BuilderDependency.
20 21 22 23 |
# File 'lib/scorpion/dependency/builder_dependency.rb', line 20 def initialize( contract, builder = nil, &block ) @builder = block_given? ? block : builder super contract end |
Instance Attribute Details
#builder ⇒ #call(scorpion,*args,&block)
Returns the builder to use to fetch instances of the dependency.
15 16 17 |
# File 'lib/scorpion/dependency/builder_dependency.rb', line 15 def builder @builder end |
Instance Method Details
#fetch(hunt) ⇒ Object
26 27 28 |
# File 'lib/scorpion/dependency/builder_dependency.rb', line 26 def fetch( hunt ) builder.call( hunt, *hunt.arguments, &hunt.block ) end |