Module: Jat::Plugins::JsonApi::Response::ClassMethods

Included in:
Jat::Plugins::JsonApi::Response
Defined in:
lib/jat/plugins/json_api/lib/response.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#jat_classObject

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



10
11
12
# File 'lib/jat/plugins/json_api/lib/response.rb', line 10

def jat_class
  @jat_class
end

Instance Method Details

#call(object, context) ⇒ Object



19
20
21
# File 'lib/jat/plugins/json_api/lib/response.rb', line 19

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

#inspectObject

Since Response 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.



15
16
17
# File 'lib/jat/plugins/json_api/lib/response.rb', line 15

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