Sha256: 832f2915adc593fd1581628901a09acfc0603003a2982c2d2aff0fe8685cf57c
Contents?: true
Size: 853 Bytes
Versions: 1
Compression:
Stored size: 853 Bytes
Contents
require 'scorpion/dependency' module Scorpion class Dependency # {Dependency} that delegates to another object that implements # #call( scorpion, *args, &block ). class BuilderDependency < Scorpion::Dependency # ============================================================================ # @!group Attributes # # @!attribute # @return [#call(scorpion,*args,&block)] the builder to use to fetch instances of the dependency. attr_reader :builder # # @!endgroup Attributes def initialize( contract, traits = nil, builder = nil, &block ) @builder = block_given? ? block : builder super contract, traits end # @see Scorpion::Dependency#fetch def fetch( hunt ) builder.call( hunt, *hunt.arguments, &hunt.block ) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
scorpion-ioc-0.4.0 | lib/scorpion/dependency/builder_dependency.rb |