json_pure 1.5.5 → 1.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. data/CHANGES +3 -7
  2. data/Gemfile +0 -4
  3. data/Rakefile +0 -7
  4. data/VERSION +1 -1
  5. data/ext/json/ext/parser/parser.c +18 -18
  6. data/ext/json/ext/parser/parser.rl +1 -4
  7. data/install.rb +1 -8
  8. data/java/src/json/ext/Parser.java +85 -81
  9. data/java/src/json/ext/Parser.rl +1 -1
  10. data/json.gemspec +5 -6
  11. data/json_pure.gemspec +4 -8
  12. data/lib/json/add/core.rb +9 -244
  13. data/lib/json/add/date.rb +34 -0
  14. data/lib/json/add/date_time.rb +50 -0
  15. data/lib/json/add/exception.rb +31 -0
  16. data/lib/json/add/range.rb +29 -0
  17. data/lib/json/add/regexp.rb +30 -0
  18. data/lib/json/add/struct.rb +30 -0
  19. data/lib/json/add/symbol.rb +25 -0
  20. data/lib/json/add/time.rb +35 -0
  21. data/lib/json/common.rb +5 -12
  22. data/lib/json/pure/parser.rb +4 -4
  23. data/lib/json/version.rb +1 -1
  24. data/tests/test_json.rb +2 -22
  25. data/tests/test_json_addition.rb +21 -29
  26. data/tests/test_json_string_matching.rb +6 -5
  27. data/tools/server.rb +1 -0
  28. metadata +125 -174
  29. data/0001-Security-fix-create_additons-JSON-GenericObject.patch +0 -448
  30. data/0001-Security-fix-create_additons-problem-1.5.5.patch +0 -630
  31. data/0001-Security-fix-for-create_additions-problem-1.6.8.patch +0 -685
  32. data/Gemfile.lock +0 -60
  33. data/bin/edit_json.rb +0 -9
  34. data/bin/prettify_json.rb +0 -48
  35. data/lib/json/Array.xpm +0 -21
  36. data/lib/json/FalseClass.xpm +0 -21
  37. data/lib/json/Hash.xpm +0 -21
  38. data/lib/json/Key.xpm +0 -73
  39. data/lib/json/NilClass.xpm +0 -21
  40. data/lib/json/Numeric.xpm +0 -28
  41. data/lib/json/String.xpm +0 -96
  42. data/lib/json/TrueClass.xpm +0 -21
  43. data/lib/json/editor.rb +0 -1369
  44. data/lib/json/json.xpm +0 -1499
@@ -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", false);
165
+ this.createAdditions = opts.getBool("create_additions", true);
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");
@@ -2,22 +2,21 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "json"
5
- s.version = "1.5.5"
5
+ s.version = "1.6.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 = "2013-02-10"
9
+ s.date = "2011-09-12"
10
10
  s.description = "This is a JSON implementation as a Ruby extension in C."
11
11
  s.email = "flori@ping.de"
12
- s.executables = ["edit_json.rb", "prettify_json.rb"]
13
- s.extensions = ["ext/json/ext/generator/extconf.rb", "ext/json/ext/parser/extconf.rb"]
12
+ s.extensions = ["ext/json/ext/parser/extconf.rb", "ext/json/ext/generator/extconf.rb"]
14
13
  s.extra_rdoc_files = ["README.rdoc"]
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"]
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/version.rb", "lib/json/add", "lib/json/add/symbol.rb", "lib/json/add/struct.rb", "lib/json/add/complex.rb", "lib/json/add/rational.rb", "lib/json/add/exception.rb", "lib/json/add/time.rb", "lib/json/add/date_time.rb", "lib/json/add/core.rb", "lib/json/add/range.rb", "lib/json/add/date.rb", "lib/json/add/regexp.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/ext", "lib/json.rb", "Gemfile", "README.rdoc", "json_pure.gemspec", "GPL", "CHANGES", "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"]
16
15
  s.homepage = "http://flori.github.com/json"
17
16
  s.rdoc_options = ["--title", "JSON implemention for Ruby", "--main", "README.rdoc"]
18
17
  s.require_paths = ["ext/json/ext", "ext", "lib"]
19
18
  s.rubyforge_project = "json"
20
- s.rubygems_version = "1.8.25"
19
+ s.rubygems_version = "1.8.10"
21
20
  s.summary = "JSON Implementation for Ruby"
22
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"]
23
22
 
@@ -2,21 +2,20 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "json_pure"
5
- s.version = "1.5.5"
5
+ s.version = "1.6.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 = "2013-02-10"
9
+ s.date = "2011-09-12"
10
10
  s.description = "This is a JSON implementation in pure Ruby."
11
11
  s.email = "flori@ping.de"
12
- s.executables = ["edit_json.rb", "prettify_json.rb"]
13
12
  s.extra_rdoc_files = ["README.rdoc"]
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"]
13
+ 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/version.rb", "lib/json/add", "lib/json/add/symbol.rb", "lib/json/add/struct.rb", "lib/json/add/complex.rb", "lib/json/add/rational.rb", "lib/json/add/exception.rb", "lib/json/add/time.rb", "lib/json/add/date_time.rb", "lib/json/add/core.rb", "lib/json/add/range.rb", "lib/json/add/date.rb", "lib/json/add/regexp.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/ext", "lib/json.rb", "Gemfile", "README.rdoc", "json_pure.gemspec", "GPL", "CHANGES", "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
14
  s.homepage = "http://flori.github.com/json"
16
15
  s.rdoc_options = ["--title", "JSON implemention for ruby", "--main", "README.rdoc"]
17
16
  s.require_paths = ["lib"]
18
17
  s.rubyforge_project = "json"
19
- s.rubygems_version = "1.8.25"
18
+ s.rubygems_version = "1.8.10"
20
19
  s.summary = "JSON Implementation for Ruby"
21
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"]
22
21
 
@@ -28,19 +27,16 @@ Gem::Specification.new do |s|
28
27
  s.add_development_dependency(%q<bullshit>, [">= 0"])
29
28
  s.add_development_dependency(%q<sdoc>, [">= 0"])
30
29
  s.add_development_dependency(%q<rake>, ["~> 0.9.2"])
31
- s.add_runtime_dependency(%q<spruz>, ["~> 0.2.8"])
32
30
  else
33
31
  s.add_dependency(%q<permutation>, [">= 0"])
34
32
  s.add_dependency(%q<bullshit>, [">= 0"])
35
33
  s.add_dependency(%q<sdoc>, [">= 0"])
36
34
  s.add_dependency(%q<rake>, ["~> 0.9.2"])
37
- s.add_dependency(%q<spruz>, ["~> 0.2.8"])
38
35
  end
39
36
  else
40
37
  s.add_dependency(%q<permutation>, [">= 0"])
41
38
  s.add_dependency(%q<bullshit>, [">= 0"])
42
39
  s.add_dependency(%q<sdoc>, [">= 0"])
43
40
  s.add_dependency(%q<rake>, ["~> 0.9.2"])
44
- s.add_dependency(%q<spruz>, ["~> 0.2.8"])
45
41
  end
46
42
  end
@@ -1,246 +1,11 @@
1
- # This file contains implementations of ruby core's custom objects for
1
+ # This file requires the implementations of ruby core's custom objects for
2
2
  # serialisation/deserialisation.
3
3
 
4
- unless defined?(::JSON::JSON_LOADED) and ::JSON::JSON_LOADED
5
- require 'json'
6
- end
7
- require 'date'
8
-
9
- # Symbol serialization/deserialization
10
- class Symbol
11
- # Returns a hash, that will be turned into a JSON object and represent this
12
- # object.
13
- def as_json(*)
14
- {
15
- JSON.create_id => self.class.name,
16
- 's' => to_s,
17
- }
18
- end
19
-
20
- # Stores class name (Symbol) with String representation of Symbol as a JSON string.
21
- def to_json(*a)
22
- as_json.to_json(*a)
23
- end
24
-
25
- # Deserializes JSON string by converting the <tt>string</tt> value stored in the object to a Symbol
26
- def self.json_create(o)
27
- o['s'].to_sym
28
- end
29
- end
30
-
31
- # Time serialization/deserialization
32
- class Time
33
-
34
- # Deserializes JSON string by converting time since epoch to Time
35
- def self.json_create(object)
36
- if usec = object.delete('u') # used to be tv_usec -> tv_nsec
37
- object['n'] = usec * 1000
38
- end
39
- if instance_methods.include?(:tv_nsec)
40
- at(object['s'], Rational(object['n'], 1000))
41
- else
42
- at(object['s'], object['n'] / 1000)
43
- end
44
- end
45
-
46
- # Returns a hash, that will be turned into a JSON object and represent this
47
- # object.
48
- def as_json(*)
49
- nanoseconds = [ tv_usec * 1000 ]
50
- respond_to?(:tv_nsec) and nanoseconds << tv_nsec
51
- nanoseconds = nanoseconds.max
52
- {
53
- JSON.create_id => self.class.name,
54
- 's' => tv_sec,
55
- 'n' => nanoseconds,
56
- }
57
- end
58
-
59
- # Stores class name (Time) with number of seconds since epoch and number of
60
- # microseconds for Time as JSON string
61
- def to_json(*args)
62
- as_json.to_json(*args)
63
- end
64
- end
65
-
66
- # Date serialization/deserialization
67
- class Date
68
-
69
- # Deserializes JSON string by converting Julian year <tt>y</tt>, month
70
- # <tt>m</tt>, day <tt>d</tt> and Day of Calendar Reform <tt>sg</tt> to Date.
71
- def self.json_create(object)
72
- civil(*object.values_at('y', 'm', 'd', 'sg'))
73
- end
74
-
75
- alias start sg unless method_defined?(:start)
76
-
77
- # Returns a hash, that will be turned into a JSON object and represent this
78
- # object.
79
- def as_json(*)
80
- {
81
- JSON.create_id => self.class.name,
82
- 'y' => year,
83
- 'm' => month,
84
- 'd' => day,
85
- 'sg' => start,
86
- }
87
- end
88
-
89
- # Stores class name (Date) with Julian year <tt>y</tt>, month <tt>m</tt>, day
90
- # <tt>d</tt> and Day of Calendar Reform <tt>sg</tt> as JSON string
91
- def to_json(*args)
92
- as_json.to_json(*args)
93
- end
94
- end
95
-
96
- # DateTime serialization/deserialization
97
- class DateTime
98
-
99
- # Deserializes JSON string by converting year <tt>y</tt>, month <tt>m</tt>,
100
- # day <tt>d</tt>, hour <tt>H</tt>, minute <tt>M</tt>, second <tt>S</tt>,
101
- # offset <tt>of</tt> and Day of Calendar Reform <tt>sg</tt> to DateTime.
102
- def self.json_create(object)
103
- args = object.values_at('y', 'm', 'd', 'H', 'M', 'S')
104
- of_a, of_b = object['of'].split('/')
105
- if of_b and of_b != '0'
106
- args << Rational(of_a.to_i, of_b.to_i)
107
- else
108
- args << of_a
109
- end
110
- args << object['sg']
111
- civil(*args)
112
- end
113
-
114
- alias start sg unless method_defined?(:start)
115
-
116
- # Returns a hash, that will be turned into a JSON object and represent this
117
- # object.
118
- def as_json(*)
119
- {
120
- JSON.create_id => self.class.name,
121
- 'y' => year,
122
- 'm' => month,
123
- 'd' => day,
124
- 'H' => hour,
125
- 'M' => min,
126
- 'S' => sec,
127
- 'of' => offset.to_s,
128
- 'sg' => start,
129
- }
130
- end
131
-
132
- # Stores class name (DateTime) with Julian year <tt>y</tt>, month <tt>m</tt>,
133
- # day <tt>d</tt>, hour <tt>H</tt>, minute <tt>M</tt>, second <tt>S</tt>,
134
- # offset <tt>of</tt> and Day of Calendar Reform <tt>sg</tt> as JSON string
135
- def to_json(*args)
136
- as_json.to_json(*args)
137
- end
138
- end
139
-
140
- # Range serialization/deserialization
141
- class Range
142
-
143
- # Deserializes JSON string by constructing new Range object with arguments
144
- # <tt>a</tt> serialized by <tt>to_json</tt>.
145
- def self.json_create(object)
146
- new(*object['a'])
147
- end
148
-
149
- # Returns a hash, that will be turned into a JSON object and represent this
150
- # object.
151
- def as_json(*)
152
- {
153
- JSON.create_id => self.class.name,
154
- 'a' => [ first, last, exclude_end? ]
155
- }
156
- end
157
-
158
- # Stores class name (Range) with JSON array of arguments <tt>a</tt> which
159
- # include <tt>first</tt> (integer), <tt>last</tt> (integer), and
160
- # <tt>exclude_end?</tt> (boolean) as JSON string.
161
- def to_json(*args)
162
- as_json.to_json(*args)
163
- end
164
- end
165
-
166
- # Struct serialization/deserialization
167
- class Struct
168
-
169
- # Deserializes JSON string by constructing new Struct object with values
170
- # <tt>v</tt> serialized by <tt>to_json</tt>.
171
- def self.json_create(object)
172
- new(*object['v'])
173
- end
174
-
175
- # Returns a hash, that will be turned into a JSON object and represent this
176
- # object.
177
- def as_json(*)
178
- klass = self.class.name
179
- klass.to_s.empty? and raise JSON::JSONError, "Only named structs are supported!"
180
- {
181
- JSON.create_id => klass,
182
- 'v' => values,
183
- }
184
- end
185
-
186
- # Stores class name (Struct) with Struct values <tt>v</tt> as a JSON string.
187
- # Only named structs are supported.
188
- def to_json(*args)
189
- as_json.to_json(*args)
190
- end
191
- end
192
-
193
- # Exception serialization/deserialization
194
- class Exception
195
-
196
- # Deserializes JSON string by constructing new Exception object with message
197
- # <tt>m</tt> and backtrace <tt>b</tt> serialized with <tt>to_json</tt>
198
- def self.json_create(object)
199
- result = new(object['m'])
200
- result.set_backtrace object['b']
201
- result
202
- end
203
-
204
- # Returns a hash, that will be turned into a JSON object and represent this
205
- # object.
206
- def as_json(*)
207
- {
208
- JSON.create_id => self.class.name,
209
- 'm' => message,
210
- 'b' => backtrace,
211
- }
212
- end
213
-
214
- # Stores class name (Exception) with message <tt>m</tt> and backtrace array
215
- # <tt>b</tt> as JSON string
216
- def to_json(*args)
217
- as_json.to_json(*args)
218
- end
219
- end
220
-
221
- # Regexp serialization/deserialization
222
- class Regexp
223
-
224
- # Deserializes JSON string by constructing new Regexp object with source
225
- # <tt>s</tt> (Regexp or String) and options <tt>o</tt> serialized by
226
- # <tt>to_json</tt>
227
- def self.json_create(object)
228
- new(object['s'], object['o'])
229
- end
230
-
231
- # Returns a hash, that will be turned into a JSON object and represent this
232
- # object.
233
- def as_json(*)
234
- {
235
- JSON.create_id => self.class.name,
236
- 'o' => options,
237
- 's' => source,
238
- }
239
- end
240
-
241
- # Stores class name (Regexp) with options <tt>o</tt> and source <tt>s</tt>
242
- # (Regexp or String) as JSON string
243
- def to_json(*)
244
- as_json.to_json
245
- end
246
- end
4
+ require 'json/add/date'
5
+ require 'json/add/date_time'
6
+ require 'json/add/exception'
7
+ require 'json/add/range'
8
+ require 'json/add/regexp'
9
+ require 'json/add/struct'
10
+ require 'json/add/symbol'
11
+ require 'json/add/time'
@@ -0,0 +1,34 @@
1
+ unless defined?(::JSON::JSON_LOADED) and ::JSON::JSON_LOADED
2
+ require 'json'
3
+ end
4
+ require 'date'
5
+
6
+ # Date serialization/deserialization
7
+ class Date
8
+
9
+ # Deserializes JSON string by converting Julian year <tt>y</tt>, month
10
+ # <tt>m</tt>, day <tt>d</tt> and Day of Calendar Reform <tt>sg</tt> to Date.
11
+ def self.json_create(object)
12
+ civil(*object.values_at('y', 'm', 'd', 'sg'))
13
+ end
14
+
15
+ alias start sg unless method_defined?(:start)
16
+
17
+ # Returns a hash, that will be turned into a JSON object and represent this
18
+ # object.
19
+ def as_json(*)
20
+ {
21
+ JSON.create_id => self.class.name,
22
+ 'y' => year,
23
+ 'm' => month,
24
+ 'd' => day,
25
+ 'sg' => start,
26
+ }
27
+ end
28
+
29
+ # Stores class name (Date) with Julian year <tt>y</tt>, month <tt>m</tt>, day
30
+ # <tt>d</tt> and Day of Calendar Reform <tt>sg</tt> as JSON string
31
+ def to_json(*args)
32
+ as_json.to_json(*args)
33
+ end
34
+ end
@@ -0,0 +1,50 @@
1
+ unless defined?(::JSON::JSON_LOADED) and ::JSON::JSON_LOADED
2
+ require 'json'
3
+ end
4
+ require 'date'
5
+
6
+ # DateTime serialization/deserialization
7
+ class DateTime
8
+
9
+ # Deserializes JSON string by converting year <tt>y</tt>, month <tt>m</tt>,
10
+ # day <tt>d</tt>, hour <tt>H</tt>, minute <tt>M</tt>, second <tt>S</tt>,
11
+ # offset <tt>of</tt> and Day of Calendar Reform <tt>sg</tt> to DateTime.
12
+ def self.json_create(object)
13
+ args = object.values_at('y', 'm', 'd', 'H', 'M', 'S')
14
+ of_a, of_b = object['of'].split('/')
15
+ if of_b and of_b != '0'
16
+ args << Rational(of_a.to_i, of_b.to_i)
17
+ else
18
+ args << of_a
19
+ end
20
+ args << object['sg']
21
+ civil(*args)
22
+ end
23
+
24
+ alias start sg unless method_defined?(:start)
25
+
26
+ # Returns a hash, that will be turned into a JSON object and represent this
27
+ # object.
28
+ def as_json(*)
29
+ {
30
+ JSON.create_id => self.class.name,
31
+ 'y' => year,
32
+ 'm' => month,
33
+ 'd' => day,
34
+ 'H' => hour,
35
+ 'M' => min,
36
+ 'S' => sec,
37
+ 'of' => offset.to_s,
38
+ 'sg' => start,
39
+ }
40
+ end
41
+
42
+ # Stores class name (DateTime) with Julian year <tt>y</tt>, month <tt>m</tt>,
43
+ # day <tt>d</tt>, hour <tt>H</tt>, minute <tt>M</tt>, second <tt>S</tt>,
44
+ # offset <tt>of</tt> and Day of Calendar Reform <tt>sg</tt> as JSON string
45
+ def to_json(*args)
46
+ as_json.to_json(*args)
47
+ end
48
+ end
49
+
50
+
@@ -0,0 +1,31 @@
1
+ unless defined?(::JSON::JSON_LOADED) and ::JSON::JSON_LOADED
2
+ require 'json'
3
+ end
4
+
5
+ # Exception serialization/deserialization
6
+ class Exception
7
+
8
+ # Deserializes JSON string by constructing new Exception object with message
9
+ # <tt>m</tt> and backtrace <tt>b</tt> serialized with <tt>to_json</tt>
10
+ def self.json_create(object)
11
+ result = new(object['m'])
12
+ result.set_backtrace object['b']
13
+ result
14
+ end
15
+
16
+ # Returns a hash, that will be turned into a JSON object and represent this
17
+ # object.
18
+ def as_json(*)
19
+ {
20
+ JSON.create_id => self.class.name,
21
+ 'm' => message,
22
+ 'b' => backtrace,
23
+ }
24
+ end
25
+
26
+ # Stores class name (Exception) with message <tt>m</tt> and backtrace array
27
+ # <tt>b</tt> as JSON string
28
+ def to_json(*args)
29
+ as_json.to_json(*args)
30
+ end
31
+ end