summaryrefslogtreecommitdiff
path: root/ext/json/parser/parser.rl
diff options
context:
space:
mode:
Diffstat (limited to 'ext/json/parser/parser.rl')
-rw-r--r--ext/json/parser/parser.rl7
1 files changed, 6 insertions, 1 deletions
diff --git a/ext/json/parser/parser.rl b/ext/json/parser/parser.rl
index 3ec7d1ce14..680242732e 100644
--- a/ext/json/parser/parser.rl
+++ b/ext/json/parser/parser.rl
@@ -608,7 +608,11 @@ static VALUE cParser_initialize(int argc, VALUE *argv, VALUE self)
char *ptr;
long len;
VALUE source, opts;
- GET_PARSER;
+ GET_PARSER_INIT;
+
+ if (json->Vsource) {
+ rb_raise(rb_eArgError, "already initialized instance");
+ }
rb_scan_args(argc, argv, "11", &source, &opts);
source = convert_encoding(StringValue(source));
ptr = RSTRING_PTR(source);
@@ -795,5 +799,6 @@ void Init_parser()
* Local variables:
* mode: c
* c-file-style: ruby
+ * indent-tabs-mode: nil
* End:
*/