Class: Compel::Coercion::JSON

Inherits:
Type
  • Object
show all
Defined in:
lib/compel/coercion/types/json.rb

Instance Attribute Summary

Attributes inherited from Type

#options, #value

Instance Method Summary collapse

Methods inherited from Type

coerce, #coerce, human_name, #initialize

Constructor Details

This class inherits a constructor from Compel::Coercion::Type

Instance Method Details

#coerce_valueObject



8
9
10
# File 'lib/compel/coercion/types/json.rb', line 8

def coerce_value
  ::JSON.parse(value) rescue nil
end