json_pure 1.6.8 → 1.7.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +2 -5
- data/Gemfile +7 -3
- data/VERSION +1 -1
- data/ext/json/ext/parser/parser.c +1 -1
- data/ext/json/ext/parser/parser.rl +1 -1
- data/java/src/json/ext/Parser.java +33 -33
- data/java/src/json/ext/Parser.rl +1 -1
- data/json.gemspec +6 -6
- data/json_pure.gemspec +5 -5
- data/lib/json/common.rb +8 -15
- data/lib/json/{light_object.rb → generic_object.rb} +4 -10
- data/lib/json/pure/parser.rb +4 -4
- data/lib/json/version.rb +1 -1
- data/tests/test_json.rb +6 -12
- data/tests/test_json_addition.rb +24 -32
- data/tests/test_json_generic_object.rb +35 -0
- data/tests/test_json_string_matching.rb +6 -5
- metadata +8 -5
data/CHANGES
CHANGED
@@ -1,8 +1,5 @@
|
|
1
|
-
|
2
|
-
*
|
3
|
-
possible to create additions unless
|
4
|
-
explicitely requested by setting the create_additions argument to true or
|
5
|
-
using the JSON.load/dump interface.
|
1
|
+
2012-04-28 (1.7.0)
|
2
|
+
* Add JSON::GenericObject for method access to objects transmitted via JSON.
|
6
3
|
2012-04-27 (1.6.7)
|
7
4
|
* Fix possible crash when trying to parse nil value.
|
8
5
|
2012-02-11 (1.6.6)
|
data/Gemfile
CHANGED
@@ -6,6 +6,10 @@ gemspec :name => 'json'
|
|
6
6
|
gemspec :name => 'json_pure'
|
7
7
|
gemspec :name => 'json-java'
|
8
8
|
|
9
|
-
|
10
|
-
gem '
|
11
|
-
|
9
|
+
group :development, :test do
|
10
|
+
gem 'simplecov', :platform => :mri_19
|
11
|
+
end
|
12
|
+
|
13
|
+
group :test do
|
14
|
+
gem 'test-unit', '2.4.7', :platform => :mri_19
|
15
|
+
end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.7.0
|
@@ -1680,7 +1680,7 @@ static VALUE cParser_initialize(int argc, VALUE *argv, VALUE self)
|
|
1680
1680
|
if (option_given_p(opts, tmp)) {
|
1681
1681
|
json->create_additions = RTEST(rb_hash_aref(opts, tmp));
|
1682
1682
|
} else {
|
1683
|
-
json->create_additions =
|
1683
|
+
json->create_additions = 1;
|
1684
1684
|
}
|
1685
1685
|
tmp = ID2SYM(i_create_id);
|
1686
1686
|
if (option_given_p(opts, tmp)) {
|
@@ -664,7 +664,7 @@ static VALUE cParser_initialize(int argc, VALUE *argv, VALUE self)
|
|
664
664
|
if (option_given_p(opts, tmp)) {
|
665
665
|
json->create_additions = RTEST(rb_hash_aref(opts, tmp));
|
666
666
|
} else {
|
667
|
-
json->create_additions =
|
667
|
+
json->create_additions = 1;
|
668
668
|
}
|
669
669
|
tmp = ID2SYM(i_create_id);
|
670
670
|
if (option_given_p(opts, tmp)) {
|
@@ -166,7 +166,7 @@ public class Parser extends RubyObject {
|
|
166
166
|
this.symbolizeNames = opts.getBool("symbolize_names", false);
|
167
167
|
this.quirksMode = opts.getBool("quirks_mode", false);
|
168
168
|
this.createId = opts.getString("create_id", getCreateId(context));
|
169
|
-
this.createAdditions = opts.getBool("create_additions",
|
169
|
+
this.createAdditions = opts.getBool("create_additions", true);
|
170
170
|
this.objectClass = opts.getClass("object_class", runtime.getHash());
|
171
171
|
this.arrayClass = opts.getClass("array_class", runtime.getArray());
|
172
172
|
this.match_string = opts.getHash("match_string");
|
@@ -1617,14 +1617,14 @@ static final int JSON_array_en_main = 1;
|
|
1617
1617
|
}
|
1618
1618
|
|
1619
1619
|
|
1620
|
-
// line
|
1620
|
+
// line 1623 "Parser.java"
|
1621
1621
|
{
|
1622
1622
|
cs = JSON_array_start;
|
1623
1623
|
}
|
1624
1624
|
|
1625
|
-
// line
|
1625
|
+
// line 714 "Parser.rl"
|
1626
1626
|
|
1627
|
-
// line
|
1627
|
+
// line 1630 "Parser.java"
|
1628
1628
|
{
|
1629
1629
|
int _klen;
|
1630
1630
|
int _trans = 0;
|
@@ -1728,7 +1728,7 @@ case 1:
|
|
1728
1728
|
{ p += 1; _goto_targ = 5; if (true) continue _goto;}
|
1729
1729
|
}
|
1730
1730
|
break;
|
1731
|
-
// line
|
1731
|
+
// line 1734 "Parser.java"
|
1732
1732
|
}
|
1733
1733
|
}
|
1734
1734
|
}
|
@@ -1748,7 +1748,7 @@ case 5:
|
|
1748
1748
|
break; }
|
1749
1749
|
}
|
1750
1750
|
|
1751
|
-
// line
|
1751
|
+
// line 715 "Parser.rl"
|
1752
1752
|
|
1753
1753
|
if (cs >= JSON_array_first_final) {
|
1754
1754
|
res.update(result, p + 1);
|
@@ -1758,7 +1758,7 @@ case 5:
|
|
1758
1758
|
}
|
1759
1759
|
|
1760
1760
|
|
1761
|
-
// line
|
1761
|
+
// line 1764 "Parser.java"
|
1762
1762
|
private static byte[] init__JSON_object_actions_0()
|
1763
1763
|
{
|
1764
1764
|
return new byte [] {
|
@@ -1881,7 +1881,7 @@ static final int JSON_object_error = 0;
|
|
1881
1881
|
static final int JSON_object_en_main = 1;
|
1882
1882
|
|
1883
1883
|
|
1884
|
-
// line
|
1884
|
+
// line 774 "Parser.rl"
|
1885
1885
|
|
1886
1886
|
|
1887
1887
|
void parseObject(ParserResult res, int p, int pe) {
|
@@ -1906,14 +1906,14 @@ static final int JSON_object_en_main = 1;
|
|
1906
1906
|
}
|
1907
1907
|
|
1908
1908
|
|
1909
|
-
// line
|
1909
|
+
// line 1912 "Parser.java"
|
1910
1910
|
{
|
1911
1911
|
cs = JSON_object_start;
|
1912
1912
|
}
|
1913
1913
|
|
1914
|
-
// line
|
1914
|
+
// line 798 "Parser.rl"
|
1915
1915
|
|
1916
|
-
// line
|
1916
|
+
// line 1919 "Parser.java"
|
1917
1917
|
{
|
1918
1918
|
int _klen;
|
1919
1919
|
int _trans = 0;
|
@@ -1994,7 +1994,7 @@ case 1:
|
|
1994
1994
|
switch ( _JSON_object_actions[_acts++] )
|
1995
1995
|
{
|
1996
1996
|
case 0:
|
1997
|
-
// line
|
1997
|
+
// line 729 "Parser.rl"
|
1998
1998
|
{
|
1999
1999
|
parseValue(res, p, pe);
|
2000
2000
|
if (res.result == null) {
|
@@ -2011,7 +2011,7 @@ case 1:
|
|
2011
2011
|
}
|
2012
2012
|
break;
|
2013
2013
|
case 1:
|
2014
|
-
// line
|
2014
|
+
// line 744 "Parser.rl"
|
2015
2015
|
{
|
2016
2016
|
parseString(res, p, pe);
|
2017
2017
|
if (res.result == null) {
|
@@ -2031,13 +2031,13 @@ case 1:
|
|
2031
2031
|
}
|
2032
2032
|
break;
|
2033
2033
|
case 2:
|
2034
|
-
// line
|
2034
|
+
// line 762 "Parser.rl"
|
2035
2035
|
{
|
2036
2036
|
p--;
|
2037
2037
|
{ p += 1; _goto_targ = 5; if (true) continue _goto;}
|
2038
2038
|
}
|
2039
2039
|
break;
|
2040
|
-
// line
|
2040
|
+
// line 2043 "Parser.java"
|
2041
2041
|
}
|
2042
2042
|
}
|
2043
2043
|
}
|
@@ -2057,7 +2057,7 @@ case 5:
|
|
2057
2057
|
break; }
|
2058
2058
|
}
|
2059
2059
|
|
2060
|
-
// line
|
2060
|
+
// line 799 "Parser.rl"
|
2061
2061
|
|
2062
2062
|
if (cs < JSON_object_first_final) {
|
2063
2063
|
res.update(null, p + 1);
|
@@ -2090,7 +2090,7 @@ case 5:
|
|
2090
2090
|
}
|
2091
2091
|
|
2092
2092
|
|
2093
|
-
// line
|
2093
|
+
// line 2096 "Parser.java"
|
2094
2094
|
private static byte[] init__JSON_actions_0()
|
2095
2095
|
{
|
2096
2096
|
return new byte [] {
|
@@ -2194,7 +2194,7 @@ static final int JSON_error = 0;
|
|
2194
2194
|
static final int JSON_en_main = 1;
|
2195
2195
|
|
2196
2196
|
|
2197
|
-
// line
|
2197
|
+
// line 864 "Parser.rl"
|
2198
2198
|
|
2199
2199
|
|
2200
2200
|
public IRubyObject parseStrict() {
|
@@ -2204,16 +2204,16 @@ static final int JSON_en_main = 1;
|
|
2204
2204
|
ParserResult res = new ParserResult();
|
2205
2205
|
|
2206
2206
|
|
2207
|
-
// line
|
2207
|
+
// line 2210 "Parser.java"
|
2208
2208
|
{
|
2209
2209
|
cs = JSON_start;
|
2210
2210
|
}
|
2211
2211
|
|
2212
|
-
// line
|
2212
|
+
// line 873 "Parser.rl"
|
2213
2213
|
p = byteList.begin();
|
2214
2214
|
pe = p + byteList.length();
|
2215
2215
|
|
2216
|
-
// line
|
2216
|
+
// line 2219 "Parser.java"
|
2217
2217
|
{
|
2218
2218
|
int _klen;
|
2219
2219
|
int _trans = 0;
|
@@ -2294,7 +2294,7 @@ case 1:
|
|
2294
2294
|
switch ( _JSON_actions[_acts++] )
|
2295
2295
|
{
|
2296
2296
|
case 0:
|
2297
|
-
// line
|
2297
|
+
// line 836 "Parser.rl"
|
2298
2298
|
{
|
2299
2299
|
currentNesting = 1;
|
2300
2300
|
parseObject(res, p, pe);
|
@@ -2308,7 +2308,7 @@ case 1:
|
|
2308
2308
|
}
|
2309
2309
|
break;
|
2310
2310
|
case 1:
|
2311
|
-
// line
|
2311
|
+
// line 848 "Parser.rl"
|
2312
2312
|
{
|
2313
2313
|
currentNesting = 1;
|
2314
2314
|
parseArray(res, p, pe);
|
@@ -2321,7 +2321,7 @@ case 1:
|
|
2321
2321
|
}
|
2322
2322
|
}
|
2323
2323
|
break;
|
2324
|
-
// line
|
2324
|
+
// line 2327 "Parser.java"
|
2325
2325
|
}
|
2326
2326
|
}
|
2327
2327
|
}
|
@@ -2341,7 +2341,7 @@ case 5:
|
|
2341
2341
|
break; }
|
2342
2342
|
}
|
2343
2343
|
|
2344
|
-
// line
|
2344
|
+
// line 876 "Parser.rl"
|
2345
2345
|
|
2346
2346
|
if (cs >= JSON_first_final && p == pe) {
|
2347
2347
|
return result;
|
@@ -2351,7 +2351,7 @@ case 5:
|
|
2351
2351
|
}
|
2352
2352
|
|
2353
2353
|
|
2354
|
-
// line
|
2354
|
+
// line 2357 "Parser.java"
|
2355
2355
|
private static byte[] init__JSON_quirks_mode_actions_0()
|
2356
2356
|
{
|
2357
2357
|
return new byte [] {
|
@@ -2454,7 +2454,7 @@ static final int JSON_quirks_mode_error = 0;
|
|
2454
2454
|
static final int JSON_quirks_mode_en_main = 1;
|
2455
2455
|
|
2456
2456
|
|
2457
|
-
// line
|
2457
|
+
// line 904 "Parser.rl"
|
2458
2458
|
|
2459
2459
|
|
2460
2460
|
public IRubyObject parseQuirksMode() {
|
@@ -2464,16 +2464,16 @@ static final int JSON_quirks_mode_en_main = 1;
|
|
2464
2464
|
ParserResult res = new ParserResult();
|
2465
2465
|
|
2466
2466
|
|
2467
|
-
// line
|
2467
|
+
// line 2470 "Parser.java"
|
2468
2468
|
{
|
2469
2469
|
cs = JSON_quirks_mode_start;
|
2470
2470
|
}
|
2471
2471
|
|
2472
|
-
// line
|
2472
|
+
// line 913 "Parser.rl"
|
2473
2473
|
p = byteList.begin();
|
2474
2474
|
pe = p + byteList.length();
|
2475
2475
|
|
2476
|
-
// line
|
2476
|
+
// line 2479 "Parser.java"
|
2477
2477
|
{
|
2478
2478
|
int _klen;
|
2479
2479
|
int _trans = 0;
|
@@ -2554,7 +2554,7 @@ case 1:
|
|
2554
2554
|
switch ( _JSON_quirks_mode_actions[_acts++] )
|
2555
2555
|
{
|
2556
2556
|
case 0:
|
2557
|
-
// line
|
2557
|
+
// line 890 "Parser.rl"
|
2558
2558
|
{
|
2559
2559
|
parseValue(res, p, pe);
|
2560
2560
|
if (res.result == null) {
|
@@ -2566,7 +2566,7 @@ case 1:
|
|
2566
2566
|
}
|
2567
2567
|
}
|
2568
2568
|
break;
|
2569
|
-
// line
|
2569
|
+
// line 2572 "Parser.java"
|
2570
2570
|
}
|
2571
2571
|
}
|
2572
2572
|
}
|
@@ -2586,7 +2586,7 @@ case 5:
|
|
2586
2586
|
break; }
|
2587
2587
|
}
|
2588
2588
|
|
2589
|
-
// line
|
2589
|
+
// line 916 "Parser.rl"
|
2590
2590
|
|
2591
2591
|
if (cs >= JSON_quirks_mode_first_final && p == pe) {
|
2592
2592
|
return result;
|
data/java/src/json/ext/Parser.rl
CHANGED
@@ -164,7 +164,7 @@ public class Parser extends RubyObject {
|
|
164
164
|
this.symbolizeNames = opts.getBool("symbolize_names", false);
|
165
165
|
this.quirksMode = opts.getBool("quirks_mode", false);
|
166
166
|
this.createId = opts.getString("create_id", getCreateId(context));
|
167
|
-
this.createAdditions = opts.getBool("create_additions",
|
167
|
+
this.createAdditions = opts.getBool("create_additions", true);
|
168
168
|
this.objectClass = opts.getClass("object_class", runtime.getHash());
|
169
169
|
this.arrayClass = opts.getClass("array_class", runtime.getArray());
|
170
170
|
this.match_string = opts.getHash("match_string");
|
data/json.gemspec
CHANGED
@@ -2,23 +2,23 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = "json"
|
5
|
-
s.version = "1.
|
5
|
+
s.version = "1.7.0"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Florian Frank"]
|
9
|
-
s.date = "
|
9
|
+
s.date = "2012-04-28"
|
10
10
|
s.description = "This is a JSON implementation as a Ruby extension in C."
|
11
11
|
s.email = "flori@ping.de"
|
12
|
-
s.extensions = ["ext/json/ext/
|
12
|
+
s.extensions = ["ext/json/ext/parser/extconf.rb", "ext/json/ext/generator/extconf.rb"]
|
13
13
|
s.extra_rdoc_files = ["README.rdoc"]
|
14
|
-
s.files = [".gitignore", ".travis.yml", "CHANGES", "COPYING", "COPYING-json-jruby", "GPL", "Gemfile", "README-json-jruby.markdown", "README.rdoc", "Rakefile", "TODO", "VERSION", "data/example.json", "data/index.html", "data/prototype.js", "diagrams/.keep", "ext/json/ext/fbuffer/fbuffer.h", "ext/json/ext/generator/extconf.rb", "ext/json/ext/generator/generator.c", "ext/json/ext/generator/generator.h", "ext/json/ext/parser/extconf.rb", "ext/json/ext/parser/parser.c", "ext/json/ext/parser/parser.h", "ext/json/ext/parser/parser.rl", "install.rb", "java/src/json/ext/ByteListTranscoder.java", "java/src/json/ext/Generator.java", "java/src/json/ext/GeneratorMethods.java", "java/src/json/ext/GeneratorService.java", "java/src/json/ext/GeneratorState.java", "java/src/json/ext/OptionsReader.java", "java/src/json/ext/Parser.java", "java/src/json/ext/Parser.rl", "java/src/json/ext/ParserService.java", "java/src/json/ext/RuntimeInfo.java", "java/src/json/ext/StringDecoder.java", "java/src/json/ext/StringEncoder.java", "java/src/json/ext/Utils.java", "json-java.gemspec", "json.gemspec", "json_pure.gemspec", "lib/json.rb", "lib/json/add/bigdecimal.rb", "lib/json/add/complex.rb", "lib/json/add/core.rb", "lib/json/add/date.rb", "lib/json/add/date_time.rb", "lib/json/add/exception.rb", "lib/json/add/ostruct.rb", "lib/json/add/range.rb", "lib/json/add/rational.rb", "lib/json/add/regexp.rb", "lib/json/add/struct.rb", "lib/json/add/symbol.rb", "lib/json/add/time.rb", "lib/json/common.rb", "lib/json/ext.rb", "lib/json/ext/.keep", "lib/json/
|
14
|
+
s.files = [".gitignore", ".travis.yml", "CHANGES", "COPYING", "COPYING-json-jruby", "GPL", "Gemfile", "README-json-jruby.markdown", "README.rdoc", "Rakefile", "TODO", "VERSION", "data/example.json", "data/index.html", "data/prototype.js", "diagrams/.keep", "ext/json/ext/fbuffer/fbuffer.h", "ext/json/ext/generator/extconf.rb", "ext/json/ext/generator/generator.c", "ext/json/ext/generator/generator.h", "ext/json/ext/parser/extconf.rb", "ext/json/ext/parser/parser.c", "ext/json/ext/parser/parser.h", "ext/json/ext/parser/parser.rl", "install.rb", "java/src/json/ext/ByteListTranscoder.java", "java/src/json/ext/Generator.java", "java/src/json/ext/GeneratorMethods.java", "java/src/json/ext/GeneratorService.java", "java/src/json/ext/GeneratorState.java", "java/src/json/ext/OptionsReader.java", "java/src/json/ext/Parser.java", "java/src/json/ext/Parser.rl", "java/src/json/ext/ParserService.java", "java/src/json/ext/RuntimeInfo.java", "java/src/json/ext/StringDecoder.java", "java/src/json/ext/StringEncoder.java", "java/src/json/ext/Utils.java", "json-java.gemspec", "json.gemspec", "json_pure.gemspec", "lib/json.rb", "lib/json/add/bigdecimal.rb", "lib/json/add/complex.rb", "lib/json/add/core.rb", "lib/json/add/date.rb", "lib/json/add/date_time.rb", "lib/json/add/exception.rb", "lib/json/add/ostruct.rb", "lib/json/add/range.rb", "lib/json/add/rational.rb", "lib/json/add/regexp.rb", "lib/json/add/struct.rb", "lib/json/add/symbol.rb", "lib/json/add/time.rb", "lib/json/common.rb", "lib/json/ext.rb", "lib/json/ext/.keep", "lib/json/generic_object.rb", "lib/json/pure.rb", "lib/json/pure/generator.rb", "lib/json/pure/parser.rb", "lib/json/version.rb", "tests/fixtures/fail1.json", "tests/fixtures/fail10.json", "tests/fixtures/fail11.json", "tests/fixtures/fail12.json", "tests/fixtures/fail13.json", "tests/fixtures/fail14.json", "tests/fixtures/fail18.json", "tests/fixtures/fail19.json", "tests/fixtures/fail2.json", "tests/fixtures/fail20.json", "tests/fixtures/fail21.json", "tests/fixtures/fail22.json", "tests/fixtures/fail23.json", "tests/fixtures/fail24.json", "tests/fixtures/fail25.json", "tests/fixtures/fail27.json", "tests/fixtures/fail28.json", "tests/fixtures/fail3.json", "tests/fixtures/fail4.json", "tests/fixtures/fail5.json", "tests/fixtures/fail6.json", "tests/fixtures/fail7.json", "tests/fixtures/fail8.json", "tests/fixtures/fail9.json", "tests/fixtures/pass1.json", "tests/fixtures/pass15.json", "tests/fixtures/pass16.json", "tests/fixtures/pass17.json", "tests/fixtures/pass2.json", "tests/fixtures/pass26.json", "tests/fixtures/pass3.json", "tests/setup_variant.rb", "tests/test_json.rb", "tests/test_json_addition.rb", "tests/test_json_encoding.rb", "tests/test_json_fixtures.rb", "tests/test_json_generate.rb", "tests/test_json_generic_object.rb", "tests/test_json_string_matching.rb", "tests/test_json_unicode.rb", "tools/fuzz.rb", "tools/server.rb", "./tests/test_json_string_matching.rb", "./tests/test_json_fixtures.rb", "./tests/test_json_unicode.rb", "./tests/test_json_addition.rb", "./tests/test_json_generate.rb", "./tests/test_json_encoding.rb", "./tests/test_json_generic_object.rb", "./tests/test_json.rb"]
|
15
15
|
s.homepage = "http://flori.github.com/json"
|
16
16
|
s.rdoc_options = ["--title", "JSON implemention for Ruby", "--main", "README.rdoc"]
|
17
17
|
s.require_paths = ["ext/json/ext", "ext", "lib"]
|
18
18
|
s.rubyforge_project = "json"
|
19
|
-
s.rubygems_version = "1.8.
|
19
|
+
s.rubygems_version = "1.8.23"
|
20
20
|
s.summary = "JSON Implementation for Ruby"
|
21
|
-
s.test_files = ["./tests/test_json_string_matching.rb", "./tests/test_json_fixtures.rb", "./tests/test_json_unicode.rb", "./tests/test_json_addition.rb", "./tests/test_json_generate.rb", "./tests/test_json_encoding.rb", "./tests/test_json.rb"]
|
21
|
+
s.test_files = ["./tests/test_json_string_matching.rb", "./tests/test_json_fixtures.rb", "./tests/test_json_unicode.rb", "./tests/test_json_addition.rb", "./tests/test_json_generate.rb", "./tests/test_json_encoding.rb", "./tests/test_json_generic_object.rb", "./tests/test_json.rb"]
|
22
22
|
|
23
23
|
if s.respond_to? :specification_version then
|
24
24
|
s.specification_version = 3
|
data/json_pure.gemspec
CHANGED
@@ -2,22 +2,22 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = "json_pure"
|
5
|
-
s.version = "1.
|
5
|
+
s.version = "1.7.0"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Florian Frank"]
|
9
|
-
s.date = "
|
9
|
+
s.date = "2012-04-28"
|
10
10
|
s.description = "This is a JSON implementation in pure Ruby."
|
11
11
|
s.email = "flori@ping.de"
|
12
12
|
s.extra_rdoc_files = ["README.rdoc"]
|
13
|
-
s.files = [".gitignore", ".travis.yml", "CHANGES", "COPYING", "COPYING-json-jruby", "GPL", "Gemfile", "README-json-jruby.markdown", "README.rdoc", "Rakefile", "TODO", "VERSION", "data/example.json", "data/index.html", "data/prototype.js", "diagrams/.keep", "ext/json/ext/fbuffer/fbuffer.h", "ext/json/ext/generator/extconf.rb", "ext/json/ext/generator/generator.c", "ext/json/ext/generator/generator.h", "ext/json/ext/parser/extconf.rb", "ext/json/ext/parser/parser.c", "ext/json/ext/parser/parser.h", "ext/json/ext/parser/parser.rl", "install.rb", "java/src/json/ext/ByteListTranscoder.java", "java/src/json/ext/Generator.java", "java/src/json/ext/GeneratorMethods.java", "java/src/json/ext/GeneratorService.java", "java/src/json/ext/GeneratorState.java", "java/src/json/ext/OptionsReader.java", "java/src/json/ext/Parser.java", "java/src/json/ext/Parser.rl", "java/src/json/ext/ParserService.java", "java/src/json/ext/RuntimeInfo.java", "java/src/json/ext/StringDecoder.java", "java/src/json/ext/StringEncoder.java", "java/src/json/ext/Utils.java", "json-java.gemspec", "json.gemspec", "json_pure.gemspec", "lib/json.rb", "lib/json/add/bigdecimal.rb", "lib/json/add/complex.rb", "lib/json/add/core.rb", "lib/json/add/date.rb", "lib/json/add/date_time.rb", "lib/json/add/exception.rb", "lib/json/add/ostruct.rb", "lib/json/add/range.rb", "lib/json/add/rational.rb", "lib/json/add/regexp.rb", "lib/json/add/struct.rb", "lib/json/add/symbol.rb", "lib/json/add/time.rb", "lib/json/common.rb", "lib/json/ext.rb", "lib/json/ext/.keep", "lib/json/
|
13
|
+
s.files = [".gitignore", ".travis.yml", "CHANGES", "COPYING", "COPYING-json-jruby", "GPL", "Gemfile", "README-json-jruby.markdown", "README.rdoc", "Rakefile", "TODO", "VERSION", "data/example.json", "data/index.html", "data/prototype.js", "diagrams/.keep", "ext/json/ext/fbuffer/fbuffer.h", "ext/json/ext/generator/extconf.rb", "ext/json/ext/generator/generator.c", "ext/json/ext/generator/generator.h", "ext/json/ext/parser/extconf.rb", "ext/json/ext/parser/parser.c", "ext/json/ext/parser/parser.h", "ext/json/ext/parser/parser.rl", "install.rb", "java/src/json/ext/ByteListTranscoder.java", "java/src/json/ext/Generator.java", "java/src/json/ext/GeneratorMethods.java", "java/src/json/ext/GeneratorService.java", "java/src/json/ext/GeneratorState.java", "java/src/json/ext/OptionsReader.java", "java/src/json/ext/Parser.java", "java/src/json/ext/Parser.rl", "java/src/json/ext/ParserService.java", "java/src/json/ext/RuntimeInfo.java", "java/src/json/ext/StringDecoder.java", "java/src/json/ext/StringEncoder.java", "java/src/json/ext/Utils.java", "json-java.gemspec", "json.gemspec", "json_pure.gemspec", "lib/json.rb", "lib/json/add/bigdecimal.rb", "lib/json/add/complex.rb", "lib/json/add/core.rb", "lib/json/add/date.rb", "lib/json/add/date_time.rb", "lib/json/add/exception.rb", "lib/json/add/ostruct.rb", "lib/json/add/range.rb", "lib/json/add/rational.rb", "lib/json/add/regexp.rb", "lib/json/add/struct.rb", "lib/json/add/symbol.rb", "lib/json/add/time.rb", "lib/json/common.rb", "lib/json/ext.rb", "lib/json/ext/.keep", "lib/json/generic_object.rb", "lib/json/pure.rb", "lib/json/pure/generator.rb", "lib/json/pure/parser.rb", "lib/json/version.rb", "tests/fixtures/fail1.json", "tests/fixtures/fail10.json", "tests/fixtures/fail11.json", "tests/fixtures/fail12.json", "tests/fixtures/fail13.json", "tests/fixtures/fail14.json", "tests/fixtures/fail18.json", "tests/fixtures/fail19.json", "tests/fixtures/fail2.json", "tests/fixtures/fail20.json", "tests/fixtures/fail21.json", "tests/fixtures/fail22.json", "tests/fixtures/fail23.json", "tests/fixtures/fail24.json", "tests/fixtures/fail25.json", "tests/fixtures/fail27.json", "tests/fixtures/fail28.json", "tests/fixtures/fail3.json", "tests/fixtures/fail4.json", "tests/fixtures/fail5.json", "tests/fixtures/fail6.json", "tests/fixtures/fail7.json", "tests/fixtures/fail8.json", "tests/fixtures/fail9.json", "tests/fixtures/pass1.json", "tests/fixtures/pass15.json", "tests/fixtures/pass16.json", "tests/fixtures/pass17.json", "tests/fixtures/pass2.json", "tests/fixtures/pass26.json", "tests/fixtures/pass3.json", "tests/setup_variant.rb", "tests/test_json.rb", "tests/test_json_addition.rb", "tests/test_json_encoding.rb", "tests/test_json_fixtures.rb", "tests/test_json_generate.rb", "tests/test_json_generic_object.rb", "tests/test_json_string_matching.rb", "tests/test_json_unicode.rb", "tools/fuzz.rb", "tools/server.rb", "./tests/test_json_string_matching.rb", "./tests/test_json_fixtures.rb", "./tests/test_json_unicode.rb", "./tests/test_json_addition.rb", "./tests/test_json_generate.rb", "./tests/test_json_encoding.rb", "./tests/test_json_generic_object.rb", "./tests/test_json.rb"]
|
14
14
|
s.homepage = "http://flori.github.com/json"
|
15
15
|
s.rdoc_options = ["--title", "JSON implemention for ruby", "--main", "README.rdoc"]
|
16
16
|
s.require_paths = ["lib"]
|
17
17
|
s.rubyforge_project = "json"
|
18
|
-
s.rubygems_version = "1.8.
|
18
|
+
s.rubygems_version = "1.8.23"
|
19
19
|
s.summary = "JSON Implementation for Ruby"
|
20
|
-
s.test_files = ["./tests/test_json_string_matching.rb", "./tests/test_json_fixtures.rb", "./tests/test_json_unicode.rb", "./tests/test_json_addition.rb", "./tests/test_json_generate.rb", "./tests/test_json_encoding.rb", "./tests/test_json.rb"]
|
20
|
+
s.test_files = ["./tests/test_json_string_matching.rb", "./tests/test_json_fixtures.rb", "./tests/test_json_unicode.rb", "./tests/test_json_addition.rb", "./tests/test_json_generate.rb", "./tests/test_json_encoding.rb", "./tests/test_json_generic_object.rb", "./tests/test_json.rb"]
|
21
21
|
|
22
22
|
if s.respond_to? :specification_version then
|
23
23
|
s.specification_version = 3
|
data/lib/json/common.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
require 'json/version'
|
2
|
-
require 'json/
|
2
|
+
require 'json/generic_object'
|
3
3
|
|
4
4
|
module JSON
|
5
5
|
class << self
|
@@ -293,28 +293,21 @@ module JSON
|
|
293
293
|
attr_accessor :load_default_options
|
294
294
|
end
|
295
295
|
self.load_default_options = {
|
296
|
-
:max_nesting
|
297
|
-
:allow_nan
|
298
|
-
:quirks_mode
|
299
|
-
:create_additions => true,
|
296
|
+
:max_nesting => false,
|
297
|
+
:allow_nan => true,
|
298
|
+
:quirks_mode => true,
|
300
299
|
}
|
301
300
|
|
302
301
|
# Load a ruby data structure from a JSON _source_ and return it. A source can
|
303
302
|
# either be a string-like object, an IO-like object, or an object responding
|
304
303
|
# to the read method. If _proc_ was given, it will be called with any nested
|
305
|
-
# Ruby object as an argument recursively in depth first order.
|
306
|
-
#
|
307
|
-
#
|
308
|
-
# BEWARE: This method is meant to serialise data from trusted user input,
|
309
|
-
# like from your own database server or clients under your control, it could
|
310
|
-
# be dangerous to allow untrusted users to pass JSON sources into it. The
|
311
|
-
# default options for the parser can be changed via the load_default_options
|
312
|
-
# method.
|
304
|
+
# Ruby object as an argument recursively in depth first order. The default
|
305
|
+
# options for the parser can be changed via the load_default_options method.
|
313
306
|
#
|
314
307
|
# This method is part of the implementation of the load/dump interface of
|
315
308
|
# Marshal and YAML.
|
316
|
-
def load(source, proc = nil
|
317
|
-
opts = load_default_options
|
309
|
+
def load(source, proc = nil)
|
310
|
+
opts = load_default_options
|
318
311
|
if source.respond_to? :to_str
|
319
312
|
source = source.to_str
|
320
313
|
elsif source.respond_to? :to_io
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'ostruct'
|
2
2
|
|
3
3
|
module JSON
|
4
|
-
class
|
4
|
+
class GenericObject < OpenStruct
|
5
5
|
class << self
|
6
6
|
alias [] new
|
7
7
|
|
@@ -17,11 +17,11 @@ module JSON
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def [](name)
|
20
|
-
|
20
|
+
table[name.to_sym]
|
21
21
|
end
|
22
22
|
|
23
23
|
def []=(name, value)
|
24
|
-
|
24
|
+
__send__ "#{name}=", value
|
25
25
|
end
|
26
26
|
|
27
27
|
def |(other)
|
@@ -29,17 +29,11 @@ module JSON
|
|
29
29
|
end
|
30
30
|
|
31
31
|
def as_json(*)
|
32
|
-
|
32
|
+
{ JSON.create_id => self.class.name }.merge to_hash
|
33
33
|
end
|
34
34
|
|
35
35
|
def to_json(*a)
|
36
36
|
as_json.to_json(*a)
|
37
37
|
end
|
38
|
-
|
39
|
-
def method_missing(*a, &b)
|
40
|
-
to_hash.__send__(*a, &b)
|
41
|
-
rescue NoMethodError
|
42
|
-
super
|
43
|
-
end
|
44
38
|
end
|
45
39
|
end
|
data/lib/json/pure/parser.rb
CHANGED
@@ -63,9 +63,9 @@ module JSON
|
|
63
63
|
# * *symbolize_names*: If set to true, returns symbols for the names
|
64
64
|
# (keys) in a JSON object. Otherwise strings are returned, which is also
|
65
65
|
# the default.
|
66
|
-
# * *create_additions*: If set to
|
67
|
-
# additions
|
68
|
-
#
|
66
|
+
# * *create_additions*: If set to false, the Parser doesn't create
|
67
|
+
# additions even if a matchin class and create_id was found. This option
|
68
|
+
# defaults to true.
|
69
69
|
# * *object_class*: Defaults to Hash
|
70
70
|
# * *array_class*: Defaults to Array
|
71
71
|
# * *quirks_mode*: Enables quirks_mode for parser, that is for example
|
@@ -88,7 +88,7 @@ module JSON
|
|
88
88
|
if opts.key?(:create_additions)
|
89
89
|
@create_additions = !!opts[:create_additions]
|
90
90
|
else
|
91
|
-
@create_additions =
|
91
|
+
@create_additions = true
|
92
92
|
end
|
93
93
|
@create_id = @create_additions ? JSON.create_id : nil
|
94
94
|
@object_class = opts[:object_class] || Hash
|
data/lib/json/version.rb
CHANGED
data/tests/test_json.rb
CHANGED
@@ -316,25 +316,25 @@ class TestJSON < Test::Unit::TestCase
|
|
316
316
|
assert res.item_set?
|
317
317
|
end
|
318
318
|
|
319
|
-
def
|
320
|
-
res = parse('{"foo":"bar", "baz":{}}', :object_class => JSON::
|
321
|
-
assert_equal(JSON::
|
319
|
+
def test_parse_generic_object
|
320
|
+
res = parse('{"foo":"bar", "baz":{}}', :object_class => JSON::GenericObject)
|
321
|
+
assert_equal(JSON::GenericObject, res.class)
|
322
322
|
assert_equal "bar", res.foo
|
323
323
|
assert_equal "bar", res["foo"]
|
324
324
|
assert_equal "bar", res[:foo]
|
325
325
|
assert_equal "bar", res.to_hash[:foo]
|
326
|
-
assert_equal(JSON::
|
326
|
+
assert_equal(JSON::GenericObject, res.baz.class)
|
327
327
|
end
|
328
328
|
|
329
329
|
def test_generate_core_subclasses_with_new_to_json
|
330
330
|
obj = SubHash2["foo" => SubHash2["bar" => true]]
|
331
331
|
obj_json = JSON(obj)
|
332
|
-
obj_again = JSON
|
332
|
+
obj_again = JSON(obj_json)
|
333
333
|
assert_kind_of SubHash2, obj_again
|
334
334
|
assert_kind_of SubHash2, obj_again['foo']
|
335
335
|
assert obj_again['foo']['bar']
|
336
336
|
assert_equal obj, obj_again
|
337
|
-
assert_equal ["foo"], JSON(JSON(SubArray2["foo"])
|
337
|
+
assert_equal ["foo"], JSON(JSON(SubArray2["foo"]))
|
338
338
|
end
|
339
339
|
|
340
340
|
def test_generate_core_subclasses_with_default_to_json
|
@@ -493,12 +493,6 @@ EOT
|
|
493
493
|
assert_equal nil, JSON.load('')
|
494
494
|
end
|
495
495
|
|
496
|
-
def test_load_with_options
|
497
|
-
small_hash = JSON("foo" => 'bar')
|
498
|
-
symbol_hash = { :foo => 'bar' }
|
499
|
-
assert_equal symbol_hash, JSON.load(small_hash, nil, :symbolize_names => true)
|
500
|
-
end
|
501
|
-
|
502
496
|
def test_dump
|
503
497
|
too_deep = '[[[[[[[[[[[[[[[[[[[[]]]]]]]]]]]]]]]]]]]]'
|
504
498
|
assert_equal too_deep, JSON.dump(eval(too_deep))
|
data/tests/test_json_addition.rb
CHANGED
@@ -73,19 +73,11 @@ class TestJSONAddition < Test::Unit::TestCase
|
|
73
73
|
a = A.new(666)
|
74
74
|
assert A.json_creatable?
|
75
75
|
json = generate(a)
|
76
|
-
a_again = JSON.parse(json
|
76
|
+
a_again = JSON.parse(json)
|
77
77
|
assert_kind_of a.class, a_again
|
78
78
|
assert_equal a, a_again
|
79
79
|
end
|
80
80
|
|
81
|
-
def test_extended_json_default
|
82
|
-
a = A.new(666)
|
83
|
-
assert A.json_creatable?
|
84
|
-
json = generate(a)
|
85
|
-
a_hash = JSON.parse(json)
|
86
|
-
assert_kind_of Hash, a_hash
|
87
|
-
end
|
88
|
-
|
89
81
|
def test_extended_json_disabled
|
90
82
|
a = A.new(666)
|
91
83
|
assert A.json_creatable?
|
@@ -112,7 +104,7 @@ class TestJSONAddition < Test::Unit::TestCase
|
|
112
104
|
c = C.new
|
113
105
|
assert !C.json_creatable?
|
114
106
|
json = generate(c)
|
115
|
-
assert_raises(ArgumentError, NameError) { JSON.parse(json
|
107
|
+
assert_raises(ArgumentError, NameError) { JSON.parse(json) }
|
116
108
|
end
|
117
109
|
|
118
110
|
def test_raw_strings
|
@@ -130,7 +122,7 @@ class TestJSONAddition < Test::Unit::TestCase
|
|
130
122
|
assert_match(/\A\{.*\}\Z/, json)
|
131
123
|
assert_match(/"json_class":"String"/, json)
|
132
124
|
assert_match(/"raw":\[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,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,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255\]/, json)
|
133
|
-
raw_again = JSON.parse(json
|
125
|
+
raw_again = JSON.parse(json)
|
134
126
|
assert_equal raw, raw_again
|
135
127
|
end
|
136
128
|
|
@@ -138,17 +130,17 @@ class TestJSONAddition < Test::Unit::TestCase
|
|
138
130
|
|
139
131
|
def test_core
|
140
132
|
t = Time.now
|
141
|
-
assert_equal t, JSON(JSON(t)
|
133
|
+
assert_equal t, JSON(JSON(t))
|
142
134
|
d = Date.today
|
143
|
-
assert_equal d, JSON(JSON(d)
|
135
|
+
assert_equal d, JSON(JSON(d))
|
144
136
|
d = DateTime.civil(2007, 6, 14, 14, 57, 10, Rational(1, 12), 2299161)
|
145
|
-
assert_equal d, JSON(JSON(d)
|
146
|
-
assert_equal 1..10, JSON(JSON(1..10)
|
147
|
-
assert_equal 1...10, JSON(JSON(1...10)
|
148
|
-
assert_equal "a".."c", JSON(JSON("a".."c")
|
149
|
-
assert_equal "a"..."c", JSON(JSON("a"..."c")
|
137
|
+
assert_equal d, JSON(JSON(d))
|
138
|
+
assert_equal 1..10, JSON(JSON(1..10))
|
139
|
+
assert_equal 1...10, JSON(JSON(1...10))
|
140
|
+
assert_equal "a".."c", JSON(JSON("a".."c"))
|
141
|
+
assert_equal "a"..."c", JSON(JSON("a"..."c"))
|
150
142
|
s = MyJsonStruct.new 4711, 'foot'
|
151
|
-
assert_equal s, JSON(JSON(s)
|
143
|
+
assert_equal s, JSON(JSON(s))
|
152
144
|
struct = Struct.new :foo, :bar
|
153
145
|
s = struct.new 4711, 'foot'
|
154
146
|
assert_raises(JSONError) { JSON(s) }
|
@@ -156,41 +148,41 @@ class TestJSONAddition < Test::Unit::TestCase
|
|
156
148
|
raise TypeError, "test me"
|
157
149
|
rescue TypeError => e
|
158
150
|
e_json = JSON.generate e
|
159
|
-
e_again = JSON e_json
|
151
|
+
e_again = JSON e_json
|
160
152
|
assert_kind_of TypeError, e_again
|
161
153
|
assert_equal e.message, e_again.message
|
162
154
|
assert_equal e.backtrace, e_again.backtrace
|
163
155
|
end
|
164
|
-
assert_equal(/foo/, JSON(JSON(/foo/)
|
165
|
-
assert_equal(/foo/i, JSON(JSON(/foo/i)
|
156
|
+
assert_equal(/foo/, JSON(JSON(/foo/)))
|
157
|
+
assert_equal(/foo/i, JSON(JSON(/foo/i)))
|
166
158
|
end
|
167
159
|
|
168
160
|
def test_utc_datetime
|
169
161
|
now = Time.now
|
170
|
-
d = DateTime.parse(now.to_s
|
171
|
-
assert_equal d, JSON.parse(d.to_json
|
162
|
+
d = DateTime.parse(now.to_s) # usual case
|
163
|
+
assert_equal d, JSON.parse(d.to_json)
|
172
164
|
d = DateTime.parse(now.utc.to_s) # of = 0
|
173
|
-
assert_equal d, JSON.parse(d.to_json
|
165
|
+
assert_equal d, JSON.parse(d.to_json)
|
174
166
|
d = DateTime.civil(2008, 6, 17, 11, 48, 32, Rational(1,24))
|
175
|
-
assert_equal d, JSON.parse(d.to_json
|
167
|
+
assert_equal d, JSON.parse(d.to_json)
|
176
168
|
d = DateTime.civil(2008, 6, 17, 11, 48, 32, Rational(12,24))
|
177
|
-
assert_equal d, JSON.parse(d.to_json
|
169
|
+
assert_equal d, JSON.parse(d.to_json)
|
178
170
|
end
|
179
171
|
|
180
172
|
def test_rational_complex
|
181
|
-
assert_equal Rational(2, 9), JSON
|
182
|
-
assert_equal Complex(2, 9), JSON
|
173
|
+
assert_equal Rational(2, 9), JSON(JSON(Rational(2, 9)))
|
174
|
+
assert_equal Complex(2, 9), JSON(JSON(Complex(2, 9)))
|
183
175
|
end
|
184
176
|
|
185
177
|
def test_bigdecimal
|
186
|
-
assert_equal BigDecimal('3.141', 23), JSON(JSON(BigDecimal('3.141', 23))
|
187
|
-
assert_equal BigDecimal('3.141', 666), JSON(JSON(BigDecimal('3.141', 666))
|
178
|
+
assert_equal BigDecimal('3.141', 23), JSON(JSON(BigDecimal('3.141', 23)))
|
179
|
+
assert_equal BigDecimal('3.141', 666), JSON(JSON(BigDecimal('3.141', 666)))
|
188
180
|
end
|
189
181
|
|
190
182
|
def test_ostruct
|
191
183
|
o = OpenStruct.new
|
192
184
|
# XXX this won't work; o.foo = { :bar => true }
|
193
185
|
o.foo = { 'bar' => true }
|
194
|
-
assert_equal o, JSON
|
186
|
+
assert_equal o, JSON(JSON(o))
|
195
187
|
end
|
196
188
|
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# -*- coding: utf-8 -*-
|
3
|
+
|
4
|
+
require 'test/unit'
|
5
|
+
require File.join(File.dirname(__FILE__), 'setup_variant')
|
6
|
+
class TestJSONGenericObject < Test::Unit::TestCase
|
7
|
+
include JSON
|
8
|
+
|
9
|
+
def setup
|
10
|
+
@go = GenericObject[ :a => 1, :b => 2 ]
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_attributes
|
14
|
+
assert_equal 1, @go.a
|
15
|
+
assert_equal 1, @go[:a]
|
16
|
+
assert_equal 2, @go.b
|
17
|
+
assert_equal 2, @go[:b]
|
18
|
+
assert_nil @go.c
|
19
|
+
assert_nil @go[:c]
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_generate_json
|
23
|
+
assert_equal @go, JSON(JSON(@go))
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_parse_json
|
27
|
+
assert_equal @go, l = JSON('{ "json_class": "JSON::GenericObject", "a": 1, "b": 2 }')
|
28
|
+
assert_equal 1, l.a
|
29
|
+
assert_equal @go, l = JSON('{ "a": 1, "b": 2 }', :object_class => GenericObject)
|
30
|
+
assert_equal 1, l.a
|
31
|
+
assert_equal GenericObject[:a => GenericObject[:b => 2]],
|
32
|
+
l = JSON('{ "a": { "b": 2 } }', :object_class => GenericObject)
|
33
|
+
assert_equal 2, l.a.b
|
34
|
+
end
|
35
|
+
end
|
@@ -27,13 +27,14 @@ class TestJSONStringMatching < Test::Unit::TestCase
|
|
27
27
|
t = TestTime.new
|
28
28
|
t_json = [ t ].to_json
|
29
29
|
assert_equal [ t ],
|
30
|
-
JSON.parse(t_json,
|
31
|
-
:match_string => { /\A\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}[+-]\d{4}\
|
30
|
+
JSON.parse(t_json,
|
31
|
+
:match_string => { /\A\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}[+-]\d{4}\Z/ => TestTime })
|
32
32
|
assert_equal [ t.strftime('%FT%T%z') ],
|
33
|
-
JSON.parse(t_json,
|
34
|
-
:match_string => { /\A\d{3}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}[+-]\d{4}\
|
33
|
+
JSON.parse(t_json,
|
34
|
+
:match_string => { /\A\d{3}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}[+-]\d{4}\Z/ => TestTime })
|
35
35
|
assert_equal [ t.strftime('%FT%T%z') ],
|
36
36
|
JSON.parse(t_json,
|
37
|
-
:match_string => { /\A\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}[+-]\d{4}\
|
37
|
+
:match_string => { /\A\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}[+-]\d{4}\Z/ => TestTime },
|
38
|
+
:create_additions => false)
|
38
39
|
end
|
39
40
|
end
|
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.
|
4
|
+
version: 1.7.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2012-04-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: permutation
|
@@ -124,7 +124,7 @@ files:
|
|
124
124
|
- lib/json/common.rb
|
125
125
|
- lib/json/ext.rb
|
126
126
|
- lib/json/ext/.keep
|
127
|
-
- lib/json/
|
127
|
+
- lib/json/generic_object.rb
|
128
128
|
- lib/json/pure.rb
|
129
129
|
- lib/json/pure/generator.rb
|
130
130
|
- lib/json/pure/parser.rb
|
@@ -166,6 +166,7 @@ files:
|
|
166
166
|
- tests/test_json_encoding.rb
|
167
167
|
- tests/test_json_fixtures.rb
|
168
168
|
- tests/test_json_generate.rb
|
169
|
+
- tests/test_json_generic_object.rb
|
169
170
|
- tests/test_json_string_matching.rb
|
170
171
|
- tests/test_json_unicode.rb
|
171
172
|
- tools/fuzz.rb
|
@@ -176,6 +177,7 @@ files:
|
|
176
177
|
- ./tests/test_json_addition.rb
|
177
178
|
- ./tests/test_json_generate.rb
|
178
179
|
- ./tests/test_json_encoding.rb
|
180
|
+
- ./tests/test_json_generic_object.rb
|
179
181
|
- ./tests/test_json.rb
|
180
182
|
homepage: http://flori.github.com/json
|
181
183
|
licenses: []
|
@@ -195,7 +197,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
195
197
|
version: '0'
|
196
198
|
segments:
|
197
199
|
- 0
|
198
|
-
hash:
|
200
|
+
hash: 2019846975895868082
|
199
201
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
200
202
|
none: false
|
201
203
|
requirements:
|
@@ -204,7 +206,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
204
206
|
version: '0'
|
205
207
|
requirements: []
|
206
208
|
rubyforge_project: json
|
207
|
-
rubygems_version: 1.8.
|
209
|
+
rubygems_version: 1.8.23
|
208
210
|
signing_key:
|
209
211
|
specification_version: 3
|
210
212
|
summary: JSON Implementation for Ruby
|
@@ -215,4 +217,5 @@ test_files:
|
|
215
217
|
- ./tests/test_json_addition.rb
|
216
218
|
- ./tests/test_json_generate.rb
|
217
219
|
- ./tests/test_json_encoding.rb
|
220
|
+
- ./tests/test_json_generic_object.rb
|
218
221
|
- ./tests/test_json.rb
|