Class: ActiveModelSerializers::Adapter::JsonApi::Meta
- Inherits:
-
Object
- Object
- ActiveModelSerializers::Adapter::JsonApi::Meta
- Defined in:
- lib/active_model_serializers/adapter/json_api/meta.rb
Overview
meta definition:
JSON Object
description:
Non-standard meta-information that can not be represented as an attribute or relationship.
structure:
{
attitude: 'adjustable'
}
Instance Method Summary collapse
- #as_json ⇒ Object
-
#initialize(serializer) ⇒ Meta
constructor
A new instance of Meta.
Constructor Details
#initialize(serializer) ⇒ Meta
Returns a new instance of Meta.
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/active_model_serializers/adapter/json_api/meta.rb', line 15 def initialize(serializer) @object = serializer.object @scope = serializer.scope # Use the return value of the block unless it is nil. if serializer..respond_to?(:call) @value = instance_eval(&serializer.) else @value = serializer. end end |
Instance Method Details
#as_json ⇒ Object
27 28 29 |
# File 'lib/active_model_serializers/adapter/json_api/meta.rb', line 27 def as_json @value end |