json_pure 1.2.3 → 1.2.4
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +2 -0
- data/VERSION +1 -1
- data/ext/json/ext/parser/parser.c +3 -2
- data/ext/json/ext/parser/parser.rl +3 -2
- data/lib/json/common.rb +7 -3
- data/lib/json/version.rb +1 -1
- metadata +2 -2
data/CHANGES
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.2.
|
1
|
+
1.2.4
|
@@ -26,7 +26,7 @@ static VALUE CNaN, CInfinity, CMinusInfinity;
|
|
26
26
|
|
27
27
|
static ID i_json_creatable_p, i_json_create, i_create_id, i_create_additions,
|
28
28
|
i_chr, i_max_nesting, i_allow_nan, i_symbolize_names, i_object_class,
|
29
|
-
i_array_class, i_key_p;
|
29
|
+
i_array_class, i_key_p, i_deep_const_get;
|
30
30
|
|
31
31
|
#define MinusInfinity "-Infinity"
|
32
32
|
|
@@ -415,7 +415,7 @@ case 26:
|
|
415
415
|
if (RTEST(json->create_id)) {
|
416
416
|
VALUE klassname = rb_hash_aref(*result, json->create_id);
|
417
417
|
if (!NIL_P(klassname)) {
|
418
|
-
VALUE klass =
|
418
|
+
VALUE klass = rb_funcall(mJSON, i_deep_const_get, 1, klassname);
|
419
419
|
if RTEST(rb_funcall(klass, i_json_creatable_p, 0)) {
|
420
420
|
*result = rb_funcall(klass, i_json_create, 1, *result);
|
421
421
|
}
|
@@ -1875,6 +1875,7 @@ void Init_parser()
|
|
1875
1875
|
i_object_class = rb_intern("object_class");
|
1876
1876
|
i_array_class = rb_intern("array_class");
|
1877
1877
|
i_key_p = rb_intern("key?");
|
1878
|
+
i_deep_const_get = rb_intern("deep_const_get");
|
1878
1879
|
#ifdef HAVE_RUBY_ENCODING_H
|
1879
1880
|
mEncoding_UTF_8 = rb_funcall(rb_path2class("Encoding"), rb_intern("find"), 1, rb_str_new2("utf-8"));
|
1880
1881
|
mEncoding_UTF_16BE = rb_funcall(rb_path2class("Encoding"), rb_intern("find"), 1, rb_str_new2("utf-16be"));
|
@@ -24,7 +24,7 @@ static VALUE CNaN, CInfinity, CMinusInfinity;
|
|
24
24
|
|
25
25
|
static ID i_json_creatable_p, i_json_create, i_create_id, i_create_additions,
|
26
26
|
i_chr, i_max_nesting, i_allow_nan, i_symbolize_names, i_object_class,
|
27
|
-
i_array_class, i_key_p;
|
27
|
+
i_array_class, i_key_p, i_deep_const_get;
|
28
28
|
|
29
29
|
#define MinusInfinity "-Infinity"
|
30
30
|
|
@@ -136,7 +136,7 @@ static char *JSON_parse_object(JSON_Parser *json, char *p, char *pe, VALUE *resu
|
|
136
136
|
if (RTEST(json->create_id)) {
|
137
137
|
VALUE klassname = rb_hash_aref(*result, json->create_id);
|
138
138
|
if (!NIL_P(klassname)) {
|
139
|
-
VALUE klass =
|
139
|
+
VALUE klass = rb_funcall(mJSON, i_deep_const_get, 1, klassname);
|
140
140
|
if RTEST(rb_funcall(klass, i_json_creatable_p, 0)) {
|
141
141
|
*result = rb_funcall(klass, i_json_create, 1, *result);
|
142
142
|
}
|
@@ -732,6 +732,7 @@ void Init_parser()
|
|
732
732
|
i_object_class = rb_intern("object_class");
|
733
733
|
i_array_class = rb_intern("array_class");
|
734
734
|
i_key_p = rb_intern("key?");
|
735
|
+
i_deep_const_get = rb_intern("deep_const_get");
|
735
736
|
#ifdef HAVE_RUBY_ENCODING_H
|
736
737
|
mEncoding_UTF_8 = rb_funcall(rb_path2class("Encoding"), rb_intern("find"), 1, rb_str_new2("utf-8"));
|
737
738
|
mEncoding_UTF_16BE = rb_funcall(rb_path2class("Encoding"), rb_intern("find"), 1, rb_str_new2("utf-16be"));
|
data/lib/json/common.rb
CHANGED
@@ -33,12 +33,16 @@ module JSON
|
|
33
33
|
# level (absolute namespace path?). If there doesn't exist a constant at
|
34
34
|
# the given path, an ArgumentError is raised.
|
35
35
|
def deep_const_get(path) # :nodoc:
|
36
|
-
path
|
37
|
-
path.split(/::/).inject(Object) do |p, c|
|
36
|
+
path.to_s.split(/::/).inject(Object) do |p, c|
|
38
37
|
case
|
39
38
|
when c.empty? then p
|
40
39
|
when p.const_defined?(c) then p.const_get(c)
|
41
|
-
else
|
40
|
+
else
|
41
|
+
begin
|
42
|
+
p.const_missing(c)
|
43
|
+
rescue NameError
|
44
|
+
raise ArgumentError, "can't find const #{path}"
|
45
|
+
end
|
42
46
|
end
|
43
47
|
end
|
44
48
|
end
|
data/lib/json/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: json_pure
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Florian Frank
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-
|
12
|
+
date: 2010-04-08 00:00:00 +02:00
|
13
13
|
default_executable: edit_json.rb
|
14
14
|
dependencies: []
|
15
15
|
|