class Scorpion::Dependency::CapturedDependency

Attributes

instance[R]

@!attribute @return [Object] the instance that was captured.

specific_dependency[R]

@!attribute @return [Scorpion::Dependency] the actual dependency to hunt. Used to fetch the

single {#instance}.

Public Class Methods

new( specific_dependency ) click to toggle source

@!endgroup Attributes

# File lib/scorpion/dependency/captured_dependency.rb, line 28
def initialize( specific_dependency )
  @specific_dependency = specific_dependency
end

Public Instance Methods

fetch( hunt ) click to toggle source

@see Dependency#fetch

# File lib/scorpion/dependency/captured_dependency.rb, line 33
def fetch( hunt )
  @instance ||= specific_dependency.fetch( hunt ) # rubocop:disable Naming/MemoizedInstanceVariableName
end
release() click to toggle source

@see Dependency#release

# File lib/scorpion/dependency/captured_dependency.rb, line 38
def release
  @instance = nil
end
replicate() click to toggle source

@see Dependency#replicate

# File lib/scorpion/dependency/captured_dependency.rb, line 43
def replicate
  dup.tap(&:release)
end