class Synapse::Configuration::Definition

Represents a definition for a service being provided by the container @see DefinitionBuilder

Attributes

tags[R]

@return [Set<Symbol>] Symbols that this definition is tagged with

Public Class Methods

new(tags, prototype, factory, instance) click to toggle source

@param [Set] tags @param [Boolean] prototype @param [Proc] factory @param [Object] instance @return [undefined]

# File lib/synapse/configuration/definition.rb, line 14
def initialize(tags, prototype, factory, instance)
  @tags = tags
  @prototype = prototype
  @factory = factory
  @instance = instance
end

Public Instance Methods

resolve() click to toggle source

@return [Object]

# File lib/synapse/configuration/definition.rb, line 22
def resolve
  if @prototype
    @factory.call
  else
    @instance ||= @factory.call
  end
end