Sha256: 2155ec51dfdf1026770d3c8148319cda0d68206fc0f95cb4bb4dde40028fb9ea
Contents?: true
Size: 874 Bytes
Versions: 20
Compression:
Stored size: 874 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.dependencies, &hunt.block ) end end end end
Version data entries
20 entries across 20 versions & 1 rubygems