Class: Rosette::Core::SerializerId

Inherits:
Resolver
  • Object
show all
Defined in:
lib/rosette/core/resolvers/serializer_id.rb

Overview

Logic for handling serializer ids. Serializer ids are strings that refer to a particular serializer class. For example, the id 'yaml/rails' refers to Rosette::Serializers::YamlSerializer::RailsSerializer.

Examples:

SerializerId.resolve('yaml/rails')
# => Rosette::Serializers::YamlSerializer::RailsSerializer

Class Method Summary collapse

Methods inherited from Resolver

parse_id

Class Method Details

.resolve(serializer_id, namespace = Rosette::Serializers) ⇒ Class

Parses and identifies the class constant for the given serializer id.

Parameters:

  • serializer_id (Class, String)

    When given a class, returns the class. When given a string, parses and identifies the corresponding class constant in namespace.

  • namespace (Class) (defaults to: Rosette::Serializers)

    The namespace to look in.

Returns:

  • (Class)

    The identified class constant.


23
24
25
# File 'lib/rosette/core/resolvers/serializer_id.rb', line 23

def resolve(serializer_id, namespace = Rosette::Serializers)
  super
end