Module: Introspect
- Defined in:
- ext/oj/introspect.c
Class Method Summary collapse
-
.parser(ropts) ⇒ Object
TBD set offset on hash.
Class Method Details
.parser(ropts) ⇒ Object
TBD set offset on hash
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'ext/oj/introspect.c', line 59
static VALUE new_parser(VALUE self, VALUE ropts) {
volatile VALUE pv = oj_parser_new();
ojParser p = (ojParser)DATA_PTR(pv);
Introspect d = ALLOC(struct _introspect);
oj_init_usual(p, &d->usual);
// Set the options before switching to the Introspect delegate.
p->ctx = (void *)d;
d->free = p->free;
p->free = dfree;
d->start = p->start;
p->start = start;
// We are cheating with the mark, free, and options functions. Since
// struct _usual is the first member of struct _introspect the cast to
// Usual in the usual.c mark() function should still work just fine.
d->open_object = p->funcs[TOP_FUN].open_object;
p->funcs[TOP_FUN].open_object = open_object;
d->close_object = p->funcs[TOP_FUN].close_object;
p->funcs[TOP_FUN].close_object = close_object;
Check_Type(ropts, T_HASH);
oj_parser_set_option(p, ropts);
return pv;
}
|