Class: Synapse::Configuration::UpcasterChainDefinitionBuilder

Inherits:
DefinitionBuilder show all
Defined in:
lib/synapse/configuration/component/upcasting/upcaster_chain.rb

Overview

Definition builder used to create an upcaster chain

Note that order is very important when building an upcaster chain; the container maintains order when upcasters are registered as service definitions.

Examples:

The minimum possible effort to build an upcaster chain

upcaster_chain

Create an upcaster chain using a different identifier and properties

upcaster_chain :alt_upcaster_chain do
  use_converter_factory :alt_converter_factory
  use_upcaster_tag :alt_upcaster
end

Register an upcaster that will be picked up by an upcaster chain

factory :administrative_details_upcaster, :tag => :upcaster do
  AdministrativeDetailsUpcaster.new
end

Instance Attribute Summary

Attributes inherited from DefinitionBuilder

#id

Instance Method Summary collapse

Methods inherited from DefinitionBuilder

#anonymous, #as_prototype, #as_singleton, build, #build_composite, #build_definition, #clear_tags, #identified_by, #initialize, #register_definition, #replace_tags, #tag, #use_factory, #use_instance

Constructor Details

This class inherits a constructor from Synapse::Configuration::DefinitionBuilder

Instance Method Details

#use_converter_factory(converter_factory) ⇒ undefined

Changes the converter factory

Parameters:

  • converter_factory (Symbol)

Returns:

  • (undefined)

See Also:



27
28
29
# File 'lib/synapse/configuration/component/upcasting/upcaster_chain.rb', line 27

def use_converter_factory(converter_factory)
  @converter_factory = converter_factory
end

#use_upcaster_tag(upcaster_tag) ⇒ undefined

Changes the tag to use to automatically register upcasters

Parameters:

  • upcaster_tag (Symbol)

Returns:

  • (undefined)

See Also:



36
37
38
# File 'lib/synapse/configuration/component/upcasting/upcaster_chain.rb', line 36

def use_upcaster_tag(upcaster_tag)
  @upcaster_tag = upcaster_tag
end