Module: Jat::Plugins::JsonApi::ResponsePiece::ClassMethods

Included in:
Jat::Plugins::JsonApi::ResponsePiece
Defined in:
lib/jat/plugins/json_api/lib/response_piece.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#jat_classObject

Returns the Jat class that this ResponsePiece class is namespaced under.



9
10
11
# File 'lib/jat/plugins/json_api/lib/response_piece.rb', line 9

def jat_class
  @jat_class
end

Instance Method Details

#call(object, context, map, includes) ⇒ Object



18
19
20
# File 'lib/jat/plugins/json_api/lib/response_piece.rb', line 18

def call(object, context, map, includes)
  new(object, context, map, includes).to_h
end

#inspectObject

Since ResponsePiece is anonymously subclassed when Jat is subclassed, and then assigned to a constant of the Jat subclass, make inspect reflect the likely name for the class.



14
15
16
# File 'lib/jat/plugins/json_api/lib/response_piece.rb', line 14

def inspect
  "#{jat_class.inspect}::ResponsePiece"
end