Module: SerializerPostProcessing

Included in:
FederationEntitySerializer
Defined in:
app/serializers/serializer_post_processing.rb

Overview

This module encapsulates knowledge about the way AMS works with the serializable object. The main responsibility of this module is to allow changing resulting object just before the JSON serialization happens.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#exceptObject

except is an array of keys that are excluded from serialized_object before JSON serialization


21
22
23
# File 'app/serializers/serializer_post_processing.rb', line 21

def except
  @except
end

Instance Method Details

#modify_serializable_object(hash) ⇒ Object

Users of this module may override this method in order to change serializable_object after the serializable hash generation and before its serialization.


16
17
18
# File 'app/serializers/serializer_post_processing.rb', line 16

def modify_serializable_object(hash)
  hash
end

#serializable_object(options = {}) ⇒ Object

serializable_object output is used in AMS to produce a hash from input object that is passed to JSON serializer. serializable_object of ActiveModel::Serializer is not documented as officialy available API NOTE: if we ever move to AMS 0.10, this method was renamed there to serializable_hash


10
11
12
# File 'app/serializers/serializer_post_processing.rb', line 10

def serializable_object(options={})
  modify_serializable_object(super)
end