Class: Taro::Types::ObjectTypes::FreeFormType

Inherits:
Taro::Types::ObjectType show all
Defined in:
lib/taro/types/object_types/free_form_type.rb

Instance Method Summary collapse

Methods included from Shared::Fields

#field, #fields

Methods included from Shared::CustomFieldResolvers

included, #resolve?

Instance Method Details

#coerce_inputObject



6
7
8
# File 'lib/taro/types/object_types/free_form_type.rb', line 6

def coerce_input
  object.is_a?(Hash) && object || input_error('must be a Hash')
end

#coerce_responseObject



10
11
12
13
# File 'lib/taro/types/object_types/free_form_type.rb', line 10

def coerce_response
  object.respond_to?(:as_json) && (res = object.as_json).is_a?(Hash) && res ||
    response_error('must return a Hash from #as_json')
end