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.
17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/active_model_serializers/adapter/json_api/meta.rb', line 17 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
29 30 31 |
# File 'lib/active_model_serializers/adapter/json_api/meta.rb', line 29 def as_json @value end |