lib/oj/mimic.rb in oj-3.14.2 vs lib/oj/mimic.rb in oj-3.14.3

- old
+ new

@@ -1,6 +1,5 @@ - require 'bigdecimal' begin require 'ostruct' rescue Exception # ignore @@ -62,10 +61,12 @@ oo = Oj.default_options self.store(:max_nesting, false) self.store(:allow_nan, true) self.store(:quirks_mode, oo[:quirks_mode]) self.store(:ascii_only, (:ascii == oo[:escape_mode])) + + super end def []=(key, value) case key when :quirks_mode @@ -100,10 +101,11 @@ # Both the JSON gem and Rails monkey patch as_json. Let them battle it out. unless defined?(self.as_json) def as_json(*) name = self.class.name.to_s raise JSON::JSONError, "Only named structs are supported!" if 0 == name.length + { JSON.create_id => name, 't' => table } end end def self.json_create(h) new(h['t'] || h[:t]) @@ -230,10 +232,11 @@ # Both the JSON gem and Rails monkey patch as_json. Let them battle it out. unless defined?(self.as_json) def as_json(*) name = self.class.name.to_s raise JSON::JSONError, "Only named structs are supported!" if 0 == name.length + { JSON.create_id => name, 'v' => values } end end def self.json_create(h) new(*h['v']) @@ -271,10 +274,9 @@ else at(h['s'], h['n'] / 1000) end end end - end # self.mimic_loaded end # Oj # More monkey patches.