Module: Graphiti::JsonapiSerializableExt::RelationshipOverrides
- Defined in:
- lib/graphiti/jsonapi_serializable_ext.rb
Overview
See above comment
Instance Method Summary collapse
Instance Method Details
#data ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/graphiti/jsonapi_serializable_ext.rb', line 18 def data @_resources_block = proc do resources = yield if resources.nil? nil elsif resources.respond_to?(:to_ary) Array(resources).map do |obj| klass = obj.instance_variable_get(:@__graphiti_serializer) resource = obj.instance_variable_get(:@__graphiti_resource) klass.new(@_exposures.merge(object: obj, resource: resource)) end else klass = resources.instance_variable_get(:@__graphiti_serializer) resource = resources.instance_variable_get(:@__graphiti_resource) klass.new(@_exposures.merge(object: resources, resource: resource)) end end end |