Sha256: ff38badc617d70f016b2202b3d1bef5b5707651d9679c56787ee215f1e75aed7
Contents?: true
Size: 832 Bytes
Versions: 9
Compression:
Stored size: 832 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, builder = nil, &block ) @builder = block_given? ? block : builder super contract end # @see Scorpion::Dependency#fetch def fetch( hunt ) builder.call( hunt, *hunt.arguments, &hunt.block ) end end end end
Version data entries
9 entries across 9 versions & 1 rubygems