Method: Oj::Rails.optimize

Defined in:
ext/oj/rails.c

.optimize(*classes) ⇒ Object

Use Oj rails optimized routines to encode the specified classes. This ignores the as_json() method on the class and uses an internal encoding instead. Passing in no classes indicates all should use the optimized version of encoding for all previously optimized classes. Passing in the Object class set a global switch that will then use the optimized behavior for all classes.

  • classes [Class] a list of classes to optimize


782
783
784
785
786
787
# File 'ext/oj/rails.c', line 782

static VALUE rails_optimize(int argc, VALUE *argv, VALUE self) {
    optimize(argc, argv, &ropts, true);
    string_writer_optimized = true;

    return Qnil;
}