Class: Payload::UndefinedDefinition Private

Inherits:
Object
  • Object
show all
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

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