Exception: SmartIoC::Errors::AmbiguousBeanDefinition

Inherits:
StandardError
  • Object
show all
Defined in:
lib/smart_ioc/errors.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(bean_name, bean_definitions) ⇒ AmbiguousBeanDefinition

Returns a new instance of AmbiguousBeanDefinition.



11
12
13
14
# File 'lib/smart_ioc/errors.rb', line 11

def initialize(bean_name, bean_definitions)
  @bean_name = bean_name
  @bean_definitions = bean_definitions
end

Instance Attribute Details

#parent_bean_definitionObject

Returns the value of attribute parent_bean_definition.



9
10
11
# File 'lib/smart_ioc/errors.rb', line 9

def parent_bean_definition
  @parent_bean_definition
end

Instance Method Details

#messageObject



16
17
18
19
20
21
22
23
# File 'lib/smart_ioc/errors.rb', line 16

def message
  <<~EOS
    Unable to inject bean :#{@bean_name}#{@parent_bean_definition ? " into :#{@parent_bean_definition.name} (package: #{@parent_bean_definition.package})" : ""}.
    Several bean definitions with name :#{@bean_name} were found:

    #{@bean_definitions.map(&:inspect).join("\n\n")}
  EOS
end