Module: Cuprum::Rails::Serializers::Json

Defined in:
lib/cuprum/rails/serializers/json.rb,
lib/cuprum/rails/serializers/json/hash_serializer.rb,
lib/cuprum/rails/serializers/json/array_serializer.rb,
lib/cuprum/rails/serializers/json/error_serializer.rb,
lib/cuprum/rails/serializers/json/identity_serializer.rb,
lib/cuprum/rails/serializers/json/attributes_serializer.rb,
lib/cuprum/rails/serializers/json/properties_serializer.rb,
lib/cuprum/rails/serializers/json/active_record_serializer.rb

Overview

Namespace for JSON serializers, which convert objects to a JSON format.

Defined Under Namespace

Classes: ActiveRecordSerializer, ArraySerializer, AttributesSerializer, ErrorSerializer, HashSerializer, IdentitySerializer, PropertiesSerializer

Class Method Summary collapse

Class Method Details

.default_serializersHash<Class, Cuprum::Rails::Serializers::Json::Serializer>

Default serializers for handling value objects and data structures.

Returns:

  • (Hash<Class, Cuprum::Rails::Serializers::Json::Serializer>)

    the default serializers.



27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/cuprum/rails/serializers/json.rb', line 27

def self.default_serializers # rubocop:disable Metrics/MethodLength
  @default_serializers ||= {
    Array         => self::ArraySerializer.instance,
    Cuprum::Error => self::ErrorSerializer.instance,
    Hash          => self::HashSerializer.instance,
    FalseClass    => self::IdentitySerializer.instance,
    Float         => self::IdentitySerializer.instance,
    Integer       => self::IdentitySerializer.instance,
    NilClass      => self::IdentitySerializer.instance,
    String        => self::IdentitySerializer.instance,
    TrueClass     => self::IdentitySerializer.instance
  }
end