Method: Oj.add_to_json

Defined in:
ext/oj/oj.c

.add_to_json(*args) ⇒ Object

Override simple to_s dump behavior in :compat mode to instead use an optimized dump that includes the classname and attributes so that the object can be re-created on load. The format is the same as the json gem but does not use the ruby methods for encoding.

The classes supported for optimization are: Array, BigDecimal, Complex, Date, DateTime, Exception, Hash, Integer, OpenStruct, Range, Rational, Regexp, Struct, and Time. Providing no classes will result in all those classes being optimized.q

  • *args( [Class] zero or more classes to optimize.

[View source]

1654
# File 'ext/oj/oj.c', line 1654

extern VALUE oj_add_to_json(int argc, VALUE *argv, VALUE self);