class Scorpion::Dependency::BuilderDependency

{Dependency} that delegates to another object that implements call( scorpion, *args, &block ).

Attributes

builder[R]

@!attribute @return [#call(scorpion,*args,&block)] the builder to use to fetch instances of the dependency.

Public Class Methods

new( contract, builder = nil, &block ) click to toggle source

@!endgroup Attributes

Calls superclass method Scorpion::Dependency::new
# File lib/scorpion/dependency/builder_dependency.rb, line 20
def initialize( contract, builder = nil, &block )
  @builder = block_given? ? block : builder
  super contract
end

Public Instance Methods

fetch( hunt ) click to toggle source

@see Scorpion::Dependency#fetch

# File lib/scorpion/dependency/builder_dependency.rb, line 26
def fetch( hunt )
  builder.call( hunt, *hunt.arguments, &hunt.block )
end