Class: JSONApi::ObjectSerializer
- Inherits:
-
Object
- Object
- JSONApi::ObjectSerializer
- Defined in:
- lib/json_api/object_serializer.rb
Instance Method Summary collapse
Instance Method Details
#hashify(object, **options) ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/json_api/object_serializer.rb', line 12 def hashify(object, **) hash = { data: data_for(object, **) } if [:include].is_a?(Array) hash[:included] = [:include] end hash end |
#serialize(object, **options) ⇒ Object
8 9 10 |
# File 'lib/json_api/object_serializer.rb', line 8 def serialize(object, **) ActiveSupport::JSON.encode(hashify(object, **)) end |