Method: Oj::Doc#local_key
- Defined in:
- ext/oj/fast.c
#local_key ⇒ Object
Returns the final key to the current location. “one” Oj::Doc.open(‘‘) { |doc| doc.local_key() } #=> nil
1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 |
# File 'ext/oj/fast.c', line 1252 static VALUE doc_local_key(VALUE self) { Doc doc = self_doc(self); Leaf leaf = *doc->where; volatile VALUE key = Qnil; if (T_HASH == leaf->parent_type) { key = rb_utf8_str_new_cstr(leaf->key); } else if (T_ARRAY == leaf->parent_type) { key = LONG2NUM(leaf->index); } return key; } |