Class: ReeJson::FromJson

Inherits:
Object
  • Object
show all
Includes:
Ree::FnDSL
Defined in:
lib/ree_lib/packages/ree_json/package/ree_json/functions/from_json.rb

Constant Summary collapse

ParseJsonError =
Class.new(StandardError)

Instance Method Summary collapse

Instance Method Details

#call(object, **opts) ⇒ Object



20
21
22
23
24
25
26
27
# File 'lib/ree_lib/packages/ree_json/package/ree_json/functions/from_json.rb', line 20

def call(object, **opts)
  options = DEFAULT_OPTIONS
    .merge(opts)

  Oj.load(object, options)
rescue ArgumentError, EncodingError, TypeError
  raise ParseJsonError.new
end