Sha256: 39f3eaa848b509ef3004188e9f23e5012b7ef8008d522c689ac8d2df7a104ca8
Contents?: true
Size: 625 Bytes
Versions: 54
Compression:
Stored size: 625 Bytes
Contents
class ReeJson::FromJson include Ree::FnDSL fn :from_json do link 'ree_json/constants', -> { DEFAULT_OPTIONS & MODES & ESCAPE_MODES & TIME_FORMATS } end ParseJsonError = Class.new(StandardError) contract( Any, Kwargs[ mode: Or[*MODES] ], Ksplat[ symbol_keys?: Bool, RestKeys => Any ] => Hash ).throws(ParseJsonError) def call(object, mode: :rails, **opts) options = DEFAULT_OPTIONS .dup .merge( opts.merge(mode: mode) ) Oj.load(object, options) rescue ArgumentError, EncodingError raise ParseJsonError.new end end
Version data entries
54 entries across 54 versions & 1 rubygems