Method: JSON::Ext::Generator::State.from_state
- Defined in:
- ext/json/ext/generator/generator.c
.from_state(opts) ⇒ Object
Creates a State object from opts, which ought to be Hash to create a new State instance configured by opts, something else to create an unconfigured instance. If opts is a State object, it is just returned.
951 952 953 954 955 956 957 958 959 960 961 962 963 |
# File 'ext/json/ext/generator/generator.c', line 951 static VALUE cState_from_state_s(VALUE self, VALUE opts) { if (RTEST(rb_obj_is_kind_of(opts, self))) { return opts; } else if (RTEST(rb_obj_is_kind_of(opts, rb_cHash))) { return rb_funcall(self, i_new, 1, opts); } else { if (NIL_P(CJSON_SAFE_STATE_PROTOTYPE)) { CJSON_SAFE_STATE_PROTOTYPE = rb_const_get(mJSON, i_SAFE_STATE_PROTOTYPE); } return rb_funcall(CJSON_SAFE_STATE_PROTOTYPE, i_dup, 0); } } |