Class: Payload::UndefinedDefinition Private
- Inherits:
-
Object
- Object
- Payload::UndefinedDefinition
- Defined in:
- lib/payload/undefined_definition.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Returns from DefinitionList when attempting to find an undefined definition.
Instance Method Summary collapse
- #==(other) ⇒ Object private
- #decorate(block) ⇒ Object private
-
#initialize(name, decorators = DecoratorChain.new) ⇒ UndefinedDefinition
constructor
private
A new instance of UndefinedDefinition.
- #resolve(container) ⇒ Object private
- #set(replacement) ⇒ Object private
Constructor Details
#initialize(name, decorators = DecoratorChain.new) ⇒ UndefinedDefinition
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of UndefinedDefinition.
10 11 12 13 |
# File 'lib/payload/undefined_definition.rb', line 10 def initialize(name, decorators = DecoratorChain.new) @name = name @decorators = decorators end |
Instance Method Details
#==(other) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
15 16 17 |
# File 'lib/payload/undefined_definition.rb', line 15 def ==(other) other.is_a?(UndefinedDefinition) && name == other.name end |
#decorate(block) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
23 24 25 |
# File 'lib/payload/undefined_definition.rb', line 23 def decorate(block) self.class.new(@name, @decorators.add(block)) end |
#resolve(container) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
19 20 21 |
# File 'lib/payload/undefined_definition.rb', line 19 def resolve(container) raise UndefinedDependencyError, "No definition for dependency: #{name}" end |
#set(replacement) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
27 28 29 30 31 |
# File 'lib/payload/undefined_definition.rb', line 27 def set(replacement) @decorators.inject(replacement) do |definition, decorator| definition.decorate(decorator) end end |