json_pure 1.5.4 → 1.5.5

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGES CHANGED
@@ -1,3 +1,10 @@
1
+ 2013-02-04 (1.5.5)
2
+ * Security fix for JSON create_additions default value. It should not be
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.
6
+ * Backport change that corrects Time serialisation/deserialisation on some
7
+ platforms.
1
8
  2011-08-31 (1.5.4)
2
9
  * Fix memory leak when used from multiple JRuby. (Patch by
3
10
  jfirebaugh@github).
data/Gemfile CHANGED
@@ -5,3 +5,7 @@ source :rubygems
5
5
  gemspec :name => 'json'
6
6
  gemspec :name => 'json_pure'
7
7
  gemspec :name => 'json-java'
8
+
9
+ gem 'utils'
10
+ gem 'test-unit'
11
+ gem 'debugger', :platform => :mri_19
data/Gemfile.lock ADDED
@@ -0,0 +1,60 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ json (1.5.5)
5
+ json (1.5.5-java)
6
+ json_pure (1.5.5)
7
+ spruz (~> 0.2.8)
8
+
9
+ GEM
10
+ remote: http://rubygems.org/
11
+ specs:
12
+ bullshit (0.1.3)
13
+ dslkit (~> 0.2)
14
+ more_math (~> 0.0.2)
15
+ tins (~> 0.3)
16
+ columnize (0.3.6)
17
+ debugger (1.3.0)
18
+ columnize (>= 0.3.1)
19
+ debugger-linecache (~> 1.1.1)
20
+ debugger-ruby_core_source (~> 1.1.7)
21
+ debugger-linecache (1.1.2)
22
+ debugger-ruby_core_source (>= 1.1.1)
23
+ debugger-ruby_core_source (1.1.7)
24
+ dslkit (0.2.12)
25
+ term-ansicolor (~> 1.0)
26
+ tins (~> 0.6)
27
+ more_math (0.0.4)
28
+ tins (~> 0.3)
29
+ permutation (0.1.8)
30
+ pry-editline (1.1.1)
31
+ rake (0.9.6)
32
+ rdoc (3.12.1)
33
+ json (~> 1.4)
34
+ sdoc (0.3.20)
35
+ json (>= 1.1.3)
36
+ rdoc (~> 3.10)
37
+ spruz (0.2.13)
38
+ term-ansicolor (1.0.7)
39
+ test-unit (2.5.4)
40
+ tins (0.7.0)
41
+ utils (0.0.69)
42
+ dslkit (~> 0.2.10)
43
+ pry-editline
44
+ term-ansicolor (~> 1.0)
45
+ tins (~> 0.6)
46
+
47
+ PLATFORMS
48
+ java
49
+ ruby
50
+
51
+ DEPENDENCIES
52
+ bullshit
53
+ debugger
54
+ json!
55
+ json_pure!
56
+ permutation
57
+ rake (~> 0.9.2)
58
+ sdoc
59
+ test-unit
60
+ utils
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.5.4
1
+ 1.5.5
@@ -1671,7 +1671,7 @@ static VALUE cParser_initialize(int argc, VALUE *argv, VALUE self)
1671
1671
  if (option_given_p(opts, tmp)) {
1672
1672
  json->create_additions = RTEST(rb_hash_aref(opts, tmp));
1673
1673
  } else {
1674
- json->create_additions = 1;
1674
+ json->create_additions = 0;
1675
1675
  }
1676
1676
  tmp = ID2SYM(i_create_id);
1677
1677
  if (option_given_p(opts, tmp)) {
@@ -1718,7 +1718,7 @@ static VALUE cParser_initialize(int argc, VALUE *argv, VALUE self)
1718
1718
  }
1719
1719
 
1720
1720
 
1721
- #line 1719 "parser.c"
1721
+ #line 1722 "parser.c"
1722
1722
  static const int JSON_start = 1;
1723
1723
  static const int JSON_first_final = 10;
1724
1724
  static const int JSON_error = 0;
@@ -1726,7 +1726,7 @@ static const int JSON_error = 0;
1726
1726
  static const int JSON_en_main = 1;
1727
1727
 
1728
1728
 
1729
- #line 726 "parser.rl"
1729
+ #line 729 "parser.rl"
1730
1730
 
1731
1731
 
1732
1732
  static VALUE cParser_parse_strict(VALUE self)
@@ -1737,16 +1737,16 @@ static VALUE cParser_parse_strict(VALUE self)
1737
1737
  GET_PARSER;
1738
1738
 
1739
1739
 
1740
- #line 1738 "parser.c"
1740
+ #line 1741 "parser.c"
1741
1741
  {
1742
1742
  cs = JSON_start;
1743
1743
  }
1744
1744
 
1745
- #line 736 "parser.rl"
1745
+ #line 739 "parser.rl"
1746
1746
  p = json->source;
1747
1747
  pe = p + json->len;
1748
1748
 
1749
- #line 1747 "parser.c"
1749
+ #line 1750 "parser.c"
1750
1750
  {
1751
1751
  if ( p == pe )
1752
1752
  goto _test_eof;
@@ -1802,7 +1802,7 @@ case 5:
1802
1802
  goto st1;
1803
1803
  goto st5;
1804
1804
  tr3:
1805
- #line 715 "parser.rl"
1805
+ #line 718 "parser.rl"
1806
1806
  {
1807
1807
  char *np;
1808
1808
  json->current_nesting = 1;
@@ -1811,7 +1811,7 @@ tr3:
1811
1811
  }
1812
1812
  goto st10;
1813
1813
  tr4:
1814
- #line 708 "parser.rl"
1814
+ #line 711 "parser.rl"
1815
1815
  {
1816
1816
  char *np;
1817
1817
  json->current_nesting = 1;
@@ -1823,7 +1823,7 @@ st10:
1823
1823
  if ( ++p == pe )
1824
1824
  goto _test_eof10;
1825
1825
  case 10:
1826
- #line 1824 "parser.c"
1826
+ #line 1827 "parser.c"
1827
1827
  switch( (*p) ) {
1828
1828
  case 13: goto st10;
1829
1829
  case 32: goto st10;
@@ -1880,7 +1880,7 @@ case 9:
1880
1880
  _out: {}
1881
1881
  }
1882
1882
 
1883
- #line 739 "parser.rl"
1883
+ #line 742 "parser.rl"
1884
1884
 
1885
1885
  if (cs >= JSON_first_final && p == pe) {
1886
1886
  return result;
@@ -1892,7 +1892,7 @@ case 9:
1892
1892
 
1893
1893
 
1894
1894
 
1895
- #line 1893 "parser.c"
1895
+ #line 1896 "parser.c"
1896
1896
  static const int JSON_quirks_mode_start = 1;
1897
1897
  static const int JSON_quirks_mode_first_final = 10;
1898
1898
  static const int JSON_quirks_mode_error = 0;
@@ -1900,7 +1900,7 @@ static const int JSON_quirks_mode_error = 0;
1900
1900
  static const int JSON_quirks_mode_en_main = 1;
1901
1901
 
1902
1902
 
1903
- #line 764 "parser.rl"
1903
+ #line 767 "parser.rl"
1904
1904
 
1905
1905
 
1906
1906
  static VALUE cParser_parse_quirks_mode(VALUE self)
@@ -1911,16 +1911,16 @@ static VALUE cParser_parse_quirks_mode(VALUE self)
1911
1911
  GET_PARSER;
1912
1912
 
1913
1913
 
1914
- #line 1912 "parser.c"
1914
+ #line 1915 "parser.c"
1915
1915
  {
1916
1916
  cs = JSON_quirks_mode_start;
1917
1917
  }
1918
1918
 
1919
- #line 774 "parser.rl"
1919
+ #line 777 "parser.rl"
1920
1920
  p = json->source;
1921
1921
  pe = p + json->len;
1922
1922
 
1923
- #line 1921 "parser.c"
1923
+ #line 1924 "parser.c"
1924
1924
  {
1925
1925
  if ( p == pe )
1926
1926
  goto _test_eof;
@@ -1954,7 +1954,7 @@ st0:
1954
1954
  cs = 0;
1955
1955
  goto _out;
1956
1956
  tr2:
1957
- #line 756 "parser.rl"
1957
+ #line 759 "parser.rl"
1958
1958
  {
1959
1959
  char *np = JSON_parse_value(json, p, pe, &result);
1960
1960
  if (np == NULL) { p--; {p++; cs = 10; goto _out;} } else {p = (( np))-1;}
@@ -1964,7 +1964,7 @@ st10:
1964
1964
  if ( ++p == pe )
1965
1965
  goto _test_eof10;
1966
1966
  case 10:
1967
- #line 1965 "parser.c"
1967
+ #line 1968 "parser.c"
1968
1968
  switch( (*p) ) {
1969
1969
  case 13: goto st10;
1970
1970
  case 32: goto st10;
@@ -2053,7 +2053,7 @@ case 9:
2053
2053
  _out: {}
2054
2054
  }
2055
2055
 
2056
- #line 777 "parser.rl"
2056
+ #line 780 "parser.rl"
2057
2057
 
2058
2058
  if (cs >= JSON_quirks_mode_first_final && p == pe) {
2059
2059
  return result;
@@ -602,6 +602,9 @@ static VALUE convert_encoding(VALUE source)
602
602
  * defaults to true.
603
603
  * * *object_class*: Defaults to Hash
604
604
  * * *array_class*: Defaults to Array
605
+ * * *quirks_mode*: Enables quirks_mode for parser, that is for example
606
+ * parsing single JSON values instead of documents is possible.
607
+ *
605
608
  */
606
609
  static VALUE cParser_initialize(int argc, VALUE *argv, VALUE self)
607
610
  {
@@ -652,7 +655,7 @@ static VALUE cParser_initialize(int argc, VALUE *argv, VALUE self)
652
655
  if (option_given_p(opts, tmp)) {
653
656
  json->create_additions = RTEST(rb_hash_aref(opts, tmp));
654
657
  } else {
655
- json->create_additions = 1;
658
+ json->create_additions = 0;
656
659
  }
657
660
  tmp = ID2SYM(i_create_id);
658
661
  if (option_given_p(opts, tmp)) {
@@ -160,7 +160,7 @@ public class Parser extends RubyObject {
160
160
  this.symbolizeNames = opts.getBool("symbolize_names", false);
161
161
  this.quirksMode = opts.getBool("quirks_mode", false);
162
162
  this.createId = opts.getString("create_id", getCreateId(context));
163
- this.createAdditions = opts.getBool("create_additions", true);
163
+ this.createAdditions = opts.getBool("create_additions", false);
164
164
  this.objectClass = opts.getClass("object_class", runtime.getHash());
165
165
  this.arrayClass = opts.getClass("array_class", runtime.getArray());
166
166
  this.match_string = opts.getHash("match_string");
@@ -162,7 +162,7 @@ public class Parser extends RubyObject {
162
162
  this.symbolizeNames = opts.getBool("symbolize_names", false);
163
163
  this.quirksMode = opts.getBool("quirks_mode", false);
164
164
  this.createId = opts.getString("create_id", getCreateId(context));
165
- this.createAdditions = opts.getBool("create_additions", true);
165
+ this.createAdditions = opts.getBool("create_additions", false);
166
166
  this.objectClass = opts.getClass("object_class", runtime.getHash());
167
167
  this.arrayClass = opts.getClass("array_class", runtime.getArray());
168
168
  this.match_string = opts.getHash("match_string");
data/json.gemspec CHANGED
@@ -2,22 +2,22 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "json"
5
- s.version = "1.5.4"
5
+ s.version = "1.5.5"
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 = "2011-08-31"
9
+ s.date = "2013-02-10"
10
10
  s.description = "This is a JSON implementation as a Ruby extension in C."
11
11
  s.email = "flori@ping.de"
12
12
  s.executables = ["edit_json.rb", "prettify_json.rb"]
13
- s.extensions = ["ext/json/ext/parser/extconf.rb", "ext/json/ext/generator/extconf.rb"]
13
+ s.extensions = ["ext/json/ext/generator/extconf.rb", "ext/json/ext/parser/extconf.rb"]
14
14
  s.extra_rdoc_files = ["README.rdoc"]
15
- s.files = ["tests", "tests/test_json_string_matching.rb", "tests/test_json_fixtures.rb", "tests/setup_variant.rb", "tests/fixtures", "tests/fixtures/fail6.json", "tests/fixtures/fail9.json", "tests/fixtures/fail10.json", "tests/fixtures/fail24.json", "tests/fixtures/fail28.json", "tests/fixtures/fail13.json", "tests/fixtures/fail4.json", "tests/fixtures/pass3.json", "tests/fixtures/fail11.json", "tests/fixtures/fail14.json", "tests/fixtures/fail3.json", "tests/fixtures/fail12.json", "tests/fixtures/pass16.json", "tests/fixtures/pass15.json", "tests/fixtures/fail20.json", "tests/fixtures/fail8.json", "tests/fixtures/pass2.json", "tests/fixtures/fail5.json", "tests/fixtures/fail1.json", "tests/fixtures/fail25.json", "tests/fixtures/pass17.json", "tests/fixtures/fail7.json", "tests/fixtures/pass26.json", "tests/fixtures/fail21.json", "tests/fixtures/pass1.json", "tests/fixtures/fail23.json", "tests/fixtures/fail18.json", "tests/fixtures/fail2.json", "tests/fixtures/fail22.json", "tests/fixtures/fail27.json", "tests/fixtures/fail19.json", "tests/test_json_unicode.rb", "tests/test_json_addition.rb", "tests/test_json_generate.rb", "tests/test_json_encoding.rb", "tests/test_json.rb", "COPYING", "TODO", "Rakefile", "benchmarks", "benchmarks/data-p4-3GHz-ruby18", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt#parser.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure.log", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML.log", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails.log", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails.log", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_safe.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML#parser.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails#generator.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure.log", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_pretty-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure#parser-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt#parser-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure#parser.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails#parser-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt.log", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_fast.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_safe.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_pretty.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkComparison.log", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails#parser.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt.log", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_safe-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails#generator-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_fast-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_pretty.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_fast-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_fast.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkComparison.log", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_pretty-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML#parser-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_safe-autocorrelation.dat", "benchmarks/parser2_benchmark.rb", "benchmarks/parser_benchmark.rb", "benchmarks/generator2_benchmark.rb", "benchmarks/generator_benchmark.rb", "benchmarks/ohai.ruby", "benchmarks/data", "benchmarks/ohai.json", "lib", "lib/json", "lib/json/json.xpm", "lib/json/TrueClass.xpm", "lib/json/version.rb", "lib/json/Array.xpm", "lib/json/add", "lib/json/add/complex.rb", "lib/json/add/rational.rb", "lib/json/add/core.rb", "lib/json/common.rb", "lib/json/pure", "lib/json/pure/generator.rb", "lib/json/pure/parser.rb", "lib/json/ext.rb", "lib/json/pure.rb", "lib/json/Key.xpm", "lib/json/FalseClass.xpm", "lib/json/editor.rb", "lib/json/Numeric.xpm", "lib/json/ext", "lib/json/NilClass.xpm", "lib/json/String.xpm", "lib/json/Hash.xpm", "lib/json.rb", "Gemfile", "README.rdoc", "json_pure.gemspec", "GPL", "CHANGES", "bin", "bin/prettify_json.rb", "bin/edit_json.rb", "COPYING-json-jruby", "ext", "ext/json", "ext/json/ext", "ext/json/ext/parser", "ext/json/ext/parser/parser.h", "ext/json/ext/parser/extconf.rb", "ext/json/ext/parser/parser.rl", "ext/json/ext/parser/parser.c", "ext/json/ext/generator", "ext/json/ext/generator/generator.c", "ext/json/ext/generator/extconf.rb", "ext/json/ext/generator/generator.h", "VERSION", "data", "data/prototype.js", "data/index.html", "data/example.json", "json.gemspec", "java", "java/src", "java/src/json", "java/src/json/ext", "java/src/json/ext/Parser.java", "java/src/json/ext/RuntimeInfo.java", "java/src/json/ext/GeneratorState.java", "java/src/json/ext/OptionsReader.java", "java/src/json/ext/ParserService.java", "java/src/json/ext/Parser.rl", "java/src/json/ext/StringEncoder.java", "java/src/json/ext/GeneratorService.java", "java/src/json/ext/Utils.java", "java/src/json/ext/StringDecoder.java", "java/src/json/ext/Generator.java", "java/src/json/ext/ByteListTranscoder.java", "java/src/json/ext/GeneratorMethods.java", "java/lib", "java/lib/bytelist-1.0.6.jar", "java/lib/jcodings.jar", "diagrams", "README-json-jruby.markdown", "install.rb", "json-java.gemspec", "tools", "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.rb"]
15
+ s.files = ["0001-Security-fix-create_additons-JSON-GenericObject.patch", "0001-Security-fix-create_additons-problem-1.5.5.patch", "0001-Security-fix-for-create_additions-problem-1.6.8.patch", "CHANGES", "COPYING", "COPYING-json-jruby", "GPL", "Gemfile", "Gemfile.lock", "README-json-jruby.markdown", "README.rdoc", "Rakefile", "TODO", "VERSION", "benchmarks", "benchmarks/data", "benchmarks/data-p4-3GHz-ruby18", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkComparison.log", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_fast-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_fast.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_pretty-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_pretty.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_safe-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_safe.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt.log", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_fast-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_fast.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_pretty-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_pretty.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_safe-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_safe.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure.log", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails#generator-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails#generator.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails.log", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkComparison.log", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt#parser-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt#parser.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt.log", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure#parser-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure#parser.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure.log", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails#parser-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails#parser.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails.log", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML#parser-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML#parser.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML.log", "benchmarks/generator2_benchmark.rb", "benchmarks/generator_benchmark.rb", "benchmarks/ohai.json", "benchmarks/ohai.ruby", "benchmarks/parser2_benchmark.rb", "benchmarks/parser_benchmark.rb", "bin", "bin/edit_json.rb", "bin/prettify_json.rb", "data", "data/example.json", "data/index.html", "data/prototype.js", "diagrams", "ext", "ext/json", "ext/json/ext", "ext/json/ext/generator", "ext/json/ext/generator/extconf.rb", "ext/json/ext/generator/generator.c", "ext/json/ext/generator/generator.h", "ext/json/ext/parser", "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", "java/lib", "java/lib/bytelist-1.0.6.jar", "java/lib/jcodings.jar", "java/src", "java/src/json", "java/src/json/ext", "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", "lib/json", "lib/json.rb", "lib/json/Array.xpm", "lib/json/FalseClass.xpm", "lib/json/Hash.xpm", "lib/json/Key.xpm", "lib/json/NilClass.xpm", "lib/json/Numeric.xpm", "lib/json/String.xpm", "lib/json/TrueClass.xpm", "lib/json/add", "lib/json/add/complex.rb", "lib/json/add/core.rb", "lib/json/add/rational.rb", "lib/json/common.rb", "lib/json/editor.rb", "lib/json/ext", "lib/json/ext.rb", "lib/json/json.xpm", "lib/json/pure", "lib/json/pure.rb", "lib/json/pure/generator.rb", "lib/json/pure/parser.rb", "lib/json/version.rb", "tests", "tests/fixtures", "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_string_matching.rb", "tests/test_json_unicode.rb", "tools", "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.rb"]
16
16
  s.homepage = "http://flori.github.com/json"
17
17
  s.rdoc_options = ["--title", "JSON implemention for Ruby", "--main", "README.rdoc"]
18
18
  s.require_paths = ["ext/json/ext", "ext", "lib"]
19
19
  s.rubyforge_project = "json"
20
- s.rubygems_version = "1.8.10"
20
+ s.rubygems_version = "1.8.25"
21
21
  s.summary = "JSON Implementation for Ruby"
22
22
  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"]
23
23
 
data/json_pure.gemspec CHANGED
@@ -2,21 +2,21 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "json_pure"
5
- s.version = "1.5.4"
5
+ s.version = "1.5.5"
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 = "2011-08-31"
9
+ s.date = "2013-02-10"
10
10
  s.description = "This is a JSON implementation in pure Ruby."
11
11
  s.email = "flori@ping.de"
12
12
  s.executables = ["edit_json.rb", "prettify_json.rb"]
13
13
  s.extra_rdoc_files = ["README.rdoc"]
14
- s.files = ["tests", "tests/test_json_string_matching.rb", "tests/test_json_fixtures.rb", "tests/setup_variant.rb", "tests/fixtures", "tests/fixtures/fail6.json", "tests/fixtures/fail9.json", "tests/fixtures/fail10.json", "tests/fixtures/fail24.json", "tests/fixtures/fail28.json", "tests/fixtures/fail13.json", "tests/fixtures/fail4.json", "tests/fixtures/pass3.json", "tests/fixtures/fail11.json", "tests/fixtures/fail14.json", "tests/fixtures/fail3.json", "tests/fixtures/fail12.json", "tests/fixtures/pass16.json", "tests/fixtures/pass15.json", "tests/fixtures/fail20.json", "tests/fixtures/fail8.json", "tests/fixtures/pass2.json", "tests/fixtures/fail5.json", "tests/fixtures/fail1.json", "tests/fixtures/fail25.json", "tests/fixtures/pass17.json", "tests/fixtures/fail7.json", "tests/fixtures/pass26.json", "tests/fixtures/fail21.json", "tests/fixtures/pass1.json", "tests/fixtures/fail23.json", "tests/fixtures/fail18.json", "tests/fixtures/fail2.json", "tests/fixtures/fail22.json", "tests/fixtures/fail27.json", "tests/fixtures/fail19.json", "tests/test_json_unicode.rb", "tests/test_json_addition.rb", "tests/test_json_generate.rb", "tests/test_json_encoding.rb", "tests/test_json.rb", "COPYING", "TODO", "Rakefile", "benchmarks", "benchmarks/data-p4-3GHz-ruby18", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt#parser.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure.log", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML.log", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails.log", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails.log", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_safe.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML#parser.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails#generator.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure.log", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_pretty-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure#parser-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt#parser-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure#parser.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails#parser-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt.log", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_fast.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_safe.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_pretty.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkComparison.log", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails#parser.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt.log", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_safe-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails#generator-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_fast-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_pretty.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_fast-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_fast.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkComparison.log", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_pretty-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML#parser-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_safe-autocorrelation.dat", "benchmarks/parser2_benchmark.rb", "benchmarks/parser_benchmark.rb", "benchmarks/generator2_benchmark.rb", "benchmarks/generator_benchmark.rb", "benchmarks/ohai.ruby", "benchmarks/data", "benchmarks/ohai.json", "lib", "lib/json", "lib/json/json.xpm", "lib/json/TrueClass.xpm", "lib/json/version.rb", "lib/json/Array.xpm", "lib/json/add", "lib/json/add/complex.rb", "lib/json/add/rational.rb", "lib/json/add/core.rb", "lib/json/common.rb", "lib/json/pure", "lib/json/pure/generator.rb", "lib/json/pure/parser.rb", "lib/json/ext.rb", "lib/json/pure.rb", "lib/json/Key.xpm", "lib/json/FalseClass.xpm", "lib/json/editor.rb", "lib/json/Numeric.xpm", "lib/json/ext", "lib/json/NilClass.xpm", "lib/json/String.xpm", "lib/json/Hash.xpm", "lib/json.rb", "Gemfile", "README.rdoc", "json_pure.gemspec", "GPL", "CHANGES", "bin", "bin/prettify_json.rb", "bin/edit_json.rb", "COPYING-json-jruby", "ext", "ext/json", "ext/json/ext", "ext/json/ext/parser", "ext/json/ext/parser/parser.h", "ext/json/ext/parser/extconf.rb", "ext/json/ext/parser/parser.rl", "ext/json/ext/parser/parser.c", "ext/json/ext/generator", "ext/json/ext/generator/generator.c", "ext/json/ext/generator/extconf.rb", "ext/json/ext/generator/generator.h", "VERSION", "data", "data/prototype.js", "data/index.html", "data/example.json", "json.gemspec", "java", "java/src", "java/src/json", "java/src/json/ext", "java/src/json/ext/Parser.java", "java/src/json/ext/RuntimeInfo.java", "java/src/json/ext/GeneratorState.java", "java/src/json/ext/OptionsReader.java", "java/src/json/ext/ParserService.java", "java/src/json/ext/Parser.rl", "java/src/json/ext/StringEncoder.java", "java/src/json/ext/GeneratorService.java", "java/src/json/ext/Utils.java", "java/src/json/ext/StringDecoder.java", "java/src/json/ext/Generator.java", "java/src/json/ext/ByteListTranscoder.java", "java/src/json/ext/GeneratorMethods.java", "java/lib", "java/lib/bytelist-1.0.6.jar", "java/lib/jcodings.jar", "diagrams", "README-json-jruby.markdown", "install.rb", "json-java.gemspec", "tools", "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.rb"]
14
+ s.files = ["0001-Security-fix-create_additons-JSON-GenericObject.patch", "0001-Security-fix-create_additons-problem-1.5.5.patch", "0001-Security-fix-for-create_additions-problem-1.6.8.patch", "CHANGES", "COPYING", "COPYING-json-jruby", "GPL", "Gemfile", "Gemfile.lock", "README-json-jruby.markdown", "README.rdoc", "Rakefile", "TODO", "VERSION", "benchmarks", "benchmarks/data", "benchmarks/data-p4-3GHz-ruby18", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkComparison.log", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_fast-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_fast.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_pretty-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_pretty.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_safe-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_safe.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt.log", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_fast-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_fast.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_pretty-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_pretty.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_safe-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_safe.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure.log", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails#generator-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails#generator.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails.log", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkComparison.log", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt#parser-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt#parser.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt.log", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure#parser-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure#parser.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure.log", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails#parser-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails#parser.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails.log", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML#parser-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML#parser.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML.log", "benchmarks/generator2_benchmark.rb", "benchmarks/generator_benchmark.rb", "benchmarks/ohai.json", "benchmarks/ohai.ruby", "benchmarks/parser2_benchmark.rb", "benchmarks/parser_benchmark.rb", "bin", "bin/edit_json.rb", "bin/prettify_json.rb", "data", "data/example.json", "data/index.html", "data/prototype.js", "diagrams", "ext", "ext/json", "ext/json/ext", "ext/json/ext/generator", "ext/json/ext/generator/extconf.rb", "ext/json/ext/generator/generator.c", "ext/json/ext/generator/generator.h", "ext/json/ext/parser", "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", "java/lib", "java/lib/bytelist-1.0.6.jar", "java/lib/jcodings.jar", "java/src", "java/src/json", "java/src/json/ext", "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", "lib/json", "lib/json.rb", "lib/json/Array.xpm", "lib/json/FalseClass.xpm", "lib/json/Hash.xpm", "lib/json/Key.xpm", "lib/json/NilClass.xpm", "lib/json/Numeric.xpm", "lib/json/String.xpm", "lib/json/TrueClass.xpm", "lib/json/add", "lib/json/add/complex.rb", "lib/json/add/core.rb", "lib/json/add/rational.rb", "lib/json/common.rb", "lib/json/editor.rb", "lib/json/ext", "lib/json/ext.rb", "lib/json/json.xpm", "lib/json/pure", "lib/json/pure.rb", "lib/json/pure/generator.rb", "lib/json/pure/parser.rb", "lib/json/version.rb", "tests", "tests/fixtures", "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_string_matching.rb", "tests/test_json_unicode.rb", "tools", "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.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 = ["lib"]
18
18
  s.rubyforge_project = "json"
19
- s.rubygems_version = "1.8.10"
19
+ s.rubygems_version = "1.8.25"
20
20
  s.summary = "JSON Implementation for Ruby"
21
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"]
22
22
 
data/lib/json/add/core.rb CHANGED
@@ -36,8 +36,8 @@ class Time
36
36
  if usec = object.delete('u') # used to be tv_usec -> tv_nsec
37
37
  object['n'] = usec * 1000
38
38
  end
39
- if respond_to?(:tv_nsec)
40
- at(*object.values_at('s', 'n'))
39
+ if instance_methods.include?(:tv_nsec)
40
+ at(object['s'], Rational(object['n'], 1000))
41
41
  else
42
42
  at(object['s'], object['n'] / 1000)
43
43
  end
@@ -46,10 +46,13 @@ class Time
46
46
  # Returns a hash, that will be turned into a JSON object and represent this
47
47
  # object.
48
48
  def as_json(*)
49
+ nanoseconds = [ tv_usec * 1000 ]
50
+ respond_to?(:tv_nsec) and nanoseconds << tv_nsec
51
+ nanoseconds = nanoseconds.max
49
52
  {
50
53
  JSON.create_id => self.class.name,
51
54
  's' => tv_sec,
52
- 'n' => respond_to?(:tv_nsec) ? tv_nsec : tv_usec * 1000
55
+ 'n' => nanoseconds,
53
56
  }
54
57
  end
55
58
 
data/lib/json/common.rb CHANGED
@@ -141,7 +141,7 @@ module JSON
141
141
  # the default.
142
142
  # * *create_additions*: If set to false, the Parser doesn't create
143
143
  # additions even if a matching class and create_id was found. This option
144
- # defaults to true.
144
+ # defaults to false.
145
145
  # * *object_class*: Defaults to Hash
146
146
  # * *array_class*: Defaults to Array
147
147
  def parse(source, opts = {})
@@ -162,7 +162,7 @@ module JSON
162
162
  # to true.
163
163
  # * *create_additions*: If set to false, the Parser doesn't create
164
164
  # additions even if a matching class and create_id was found. This option
165
- # defaults to true.
165
+ # defaults to false.
166
166
  def parse!(source, opts = {})
167
167
  opts = {
168
168
  :max_nesting => false,
@@ -287,11 +287,18 @@ module JSON
287
287
  # Load a ruby data structure from a JSON _source_ and return it. A source can
288
288
  # either be a string-like object, an IO-like object, or an object responding
289
289
  # to the read method. If _proc_ was given, it will be called with any nested
290
- # Ruby object as an argument recursively in depth first order.
290
+ # Ruby object as an argument recursively in depth first order. To modify the
291
+ # default options pass in the optional _options_ argument as well.
291
292
  #
292
293
  # This method is part of the implementation of the load/dump interface of
293
294
  # Marshal and YAML.
294
- def load(source, proc = nil)
295
+ def load(source, proc = nil, options = {})
296
+ load_default_options = {
297
+ :max_nesting => false,
298
+ :allow_nan => true,
299
+ :create_additions => false
300
+ }
301
+ opts = load_default_options.merge options
295
302
  if source.respond_to? :to_str
296
303
  source = source.to_str
297
304
  elsif source.respond_to? :to_io
@@ -299,7 +306,7 @@ module JSON
299
306
  else
300
307
  source = source.read
301
308
  end
302
- result = parse(source, :max_nesting => false, :allow_nan => true)
309
+ result = parse(source, opts)
303
310
  recurse_proc(result, &proc) if proc
304
311
  result
305
312
  end
@@ -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 false, the Parser doesn't create
67
- # additions even if a matchin class and create_id was found. This option
68
- # defaults to true.
66
+ # * *create_additions*: If set to true, the Parser creates
67
+ # additions when if a matching class and create_id was found. This
68
+ # option defaults to false.
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 = true
91
+ @create_additions = false
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
@@ -1,6 +1,6 @@
1
1
  module JSON
2
2
  # JSON version
3
- VERSION = '1.5.4'
3
+ VERSION = '1.5.5'
4
4
  VERSION_ARRAY = VERSION.split(/\./).map { |x| x.to_i } # :nodoc:
5
5
  VERSION_MAJOR = VERSION_ARRAY[0] # :nodoc:
6
6
  VERSION_MINOR = VERSION_ARRAY[1] # :nodoc:
data/tests/test_json.rb CHANGED
@@ -4,6 +4,7 @@
4
4
  require 'test/unit'
5
5
  require File.join(File.dirname(__FILE__), 'setup_variant')
6
6
  require 'stringio'
7
+ require 'tempfile'
7
8
 
8
9
  unless Array.method_defined?(:permutation)
9
10
  begin
@@ -263,12 +264,12 @@ class TC_JSON < Test::Unit::TestCase
263
264
  def test_generation_of_core_subclasses_with_new_to_json
264
265
  obj = SubHash2["foo" => SubHash2["bar" => true]]
265
266
  obj_json = JSON(obj)
266
- obj_again = JSON(obj_json)
267
+ obj_again = JSON.parse(obj_json, :create_additions => true)
267
268
  assert_kind_of SubHash2, obj_again
268
269
  assert_kind_of SubHash2, obj_again['foo']
269
270
  assert obj_again['foo']['bar']
270
271
  assert_equal obj, obj_again
271
- assert_equal ["foo"], JSON(JSON(SubArray2["foo"]))
272
+ assert_equal ["foo"], JSON(JSON(SubArray2["foo"]), :create_additions => true)
272
273
  end
273
274
 
274
275
  def test_generation_of_core_subclasses_with_default_to_json
@@ -414,6 +415,25 @@ EOT
414
415
  JSON.parse('{"foo":"bar", "baz":"quux"}', :symbolize_names => true))
415
416
  end
416
417
 
418
+ def test_load
419
+ assert_equal @hash, JSON.load(@json)
420
+ tempfile = Tempfile.open('json')
421
+ tempfile.write @json
422
+ tempfile.rewind
423
+ assert_equal @hash, JSON.load(tempfile)
424
+ stringio = StringIO.new(@json)
425
+ stringio.rewind
426
+ assert_equal @hash, JSON.load(stringio)
427
+ assert_raise(NoMethodError) { JSON.load(nil) }
428
+ assert_raise(JSON::ParserError) {JSON.load('') }
429
+ end
430
+
431
+ def test_load_with_options
432
+ small_hash = JSON("foo" => 'bar')
433
+ symbol_hash = { :foo => 'bar' }
434
+ assert_equal symbol_hash, JSON.load(small_hash, nil, :symbolize_names => true)
435
+ end
436
+
417
437
  def test_load_dump
418
438
  too_deep = '[[[[[[[[[[[[[[[[[[[[]]]]]]]]]]]]]]]]]]]]'
419
439
  assert_equal too_deep, JSON.dump(eval(too_deep))