Class: Synapse::Configuration::ConverterFactoryDefinitionBuilder

Inherits:
DefinitionBuilder show all
Defined in:
lib/synapse/configuration/component/serialization/converter_factory.rb

Overview

Definition builder used to create a converter factory

Examples:

The minimum possible effort to build a converter factory

converter_factory

Create a converter factory using a different identifier and different converter tag

converter_factory :alt_converter_factory do
  use_converter_tag :alt_converter
end

Register several converters that will be picked up by a converter factory

factory :xml2ox_converter, :tag => :converter do
  Serialization::XmlToOxDocumentConverter.new
end

factory :ox2xml_converter, :tag => :converter do
  Serialization::OxDocumentToXmlConverter.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_tag(converter_tag) ⇒ undefined

Changes the tag to use to automatically register converters

Parameters:

  • converter_tag (Symbol)

Returns:

  • (undefined)

See Also:



27
28
29
# File 'lib/synapse/configuration/component/serialization/converter_factory.rb', line 27

def use_converter_tag(converter_tag)
  @converter_tag = converter_tag
end