scout 5.6.7 → 5.6.8.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (125) hide show
  1. data/CHANGELOG.markdown +4 -0
  2. data/lib/scout/version.rb +1 -1
  3. data/vendor/json_pure/.gitignore +12 -0
  4. data/vendor/json_pure/.travis.yml +20 -0
  5. data/vendor/json_pure/CHANGES +120 -0
  6. data/vendor/json_pure/COPYING-json-jruby +57 -0
  7. data/vendor/json_pure/Gemfile +11 -0
  8. data/vendor/json_pure/README-json-jruby.markdown +33 -0
  9. data/vendor/json_pure/{README → README.rdoc} +7 -7
  10. data/vendor/json_pure/Rakefile +305 -185
  11. data/vendor/json_pure/VERSION +1 -1
  12. data/vendor/json_pure/diagrams/.keep +0 -0
  13. data/vendor/json_pure/ext/json/ext/fbuffer/fbuffer.h +181 -0
  14. data/vendor/json_pure/ext/json/ext/generator/depend +1 -0
  15. data/vendor/json_pure/ext/json/ext/generator/extconf.rb +4 -6
  16. data/vendor/json_pure/ext/json/ext/generator/generator.c +463 -369
  17. data/vendor/json_pure/ext/json/ext/generator/generator.h +44 -66
  18. data/vendor/json_pure/ext/json/ext/parser/depend +1 -0
  19. data/vendor/json_pure/ext/json/ext/parser/extconf.rb +3 -5
  20. data/vendor/json_pure/ext/json/ext/parser/parser.c +580 -311
  21. data/vendor/json_pure/ext/json/ext/parser/parser.h +14 -8
  22. data/vendor/json_pure/ext/json/ext/parser/parser.rl +242 -107
  23. data/vendor/json_pure/install.rb +8 -11
  24. data/vendor/json_pure/java/src/json/ext/ByteListTranscoder.java +167 -0
  25. data/vendor/json_pure/java/src/json/ext/Generator.java +444 -0
  26. data/vendor/json_pure/java/src/json/ext/GeneratorMethods.java +232 -0
  27. data/vendor/json_pure/java/src/json/ext/GeneratorService.java +43 -0
  28. data/vendor/json_pure/java/src/json/ext/GeneratorState.java +543 -0
  29. data/vendor/json_pure/java/src/json/ext/OptionsReader.java +114 -0
  30. data/vendor/json_pure/java/src/json/ext/Parser.java +2644 -0
  31. data/vendor/json_pure/java/src/json/ext/Parser.rl +968 -0
  32. data/vendor/json_pure/java/src/json/ext/ParserService.java +35 -0
  33. data/vendor/json_pure/java/src/json/ext/RuntimeInfo.java +121 -0
  34. data/vendor/json_pure/java/src/json/ext/StringDecoder.java +167 -0
  35. data/vendor/json_pure/java/src/json/ext/StringEncoder.java +106 -0
  36. data/vendor/json_pure/java/src/json/ext/Utils.java +89 -0
  37. data/vendor/json_pure/json-java.gemspec +23 -0
  38. data/vendor/json_pure/json.gemspec +37 -0
  39. data/vendor/json_pure/json_pure.gemspec +39 -0
  40. data/vendor/json_pure/lib/json.rb +52 -0
  41. data/vendor/json_pure/lib/json/add/bigdecimal.rb +28 -0
  42. data/vendor/json_pure/lib/json/add/complex.rb +22 -0
  43. data/vendor/json_pure/lib/json/add/core.rb +9 -146
  44. data/vendor/json_pure/lib/json/add/date.rb +34 -0
  45. data/vendor/json_pure/lib/json/add/date_time.rb +50 -0
  46. data/vendor/json_pure/lib/json/add/exception.rb +31 -0
  47. data/vendor/json_pure/lib/json/add/ostruct.rb +31 -0
  48. data/vendor/json_pure/lib/json/add/range.rb +29 -0
  49. data/vendor/json_pure/lib/json/add/rational.rb +22 -0
  50. data/vendor/json_pure/lib/json/add/regexp.rb +30 -0
  51. data/vendor/json_pure/lib/json/add/struct.rb +30 -0
  52. data/vendor/json_pure/lib/json/add/symbol.rb +25 -0
  53. data/vendor/json_pure/lib/json/add/time.rb +38 -0
  54. data/vendor/json_pure/lib/json/common.rb +157 -67
  55. data/vendor/json_pure/lib/json/ext.rb +8 -2
  56. data/vendor/json_pure/lib/json/ext/.keep +0 -0
  57. data/vendor/json_pure/lib/json/generic_object.rb +70 -0
  58. data/vendor/json_pure/lib/json/pure.rb +8 -64
  59. data/vendor/json_pure/lib/json/pure/generator.rb +183 -113
  60. data/vendor/json_pure/lib/json/pure/parser.rb +118 -66
  61. data/vendor/json_pure/lib/json/version.rb +1 -1
  62. data/vendor/json_pure/tests/fixtures/fail18.json +1 -1
  63. data/vendor/json_pure/tests/setup_variant.rb +11 -0
  64. data/vendor/json_pure/tests/test_json.rb +233 -28
  65. data/vendor/json_pure/tests/test_json_addition.rb +68 -34
  66. data/vendor/json_pure/tests/test_json_encoding.rb +11 -14
  67. data/vendor/json_pure/tests/test_json_fixtures.rb +11 -10
  68. data/vendor/json_pure/tests/test_json_generate.rb +207 -7
  69. data/vendor/json_pure/tests/test_json_generic_object.rb +75 -0
  70. data/vendor/json_pure/tests/test_json_string_matching.rb +39 -0
  71. data/vendor/json_pure/tests/test_json_unicode.rb +3 -7
  72. data/vendor/json_pure/tools/fuzz.rb +1 -1
  73. data/vendor/json_pure/tools/server.rb +1 -0
  74. metadata +87 -94
  75. data/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkComparison.log +0 -52
  76. data/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_fast-autocorrelation.dat +0 -1000
  77. data/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_fast.dat +0 -1001
  78. data/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_pretty-autocorrelation.dat +0 -900
  79. data/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_pretty.dat +0 -901
  80. data/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_safe-autocorrelation.dat +0 -1000
  81. data/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_safe.dat +0 -1001
  82. data/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt.log +0 -261
  83. data/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_fast-autocorrelation.dat +0 -1000
  84. data/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_fast.dat +0 -1001
  85. data/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_pretty-autocorrelation.dat +0 -1000
  86. data/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_pretty.dat +0 -1001
  87. data/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_safe-autocorrelation.dat +0 -1000
  88. data/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_safe.dat +0 -1001
  89. data/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure.log +0 -262
  90. data/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails#generator-autocorrelation.dat +0 -1000
  91. data/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails#generator.dat +0 -1001
  92. data/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails.log +0 -82
  93. data/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkComparison.log +0 -34
  94. data/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt#parser-autocorrelation.dat +0 -900
  95. data/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt#parser.dat +0 -901
  96. data/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt.log +0 -81
  97. data/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure#parser-autocorrelation.dat +0 -1000
  98. data/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure#parser.dat +0 -1001
  99. data/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure.log +0 -82
  100. data/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails#parser-autocorrelation.dat +0 -1000
  101. data/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails#parser.dat +0 -1001
  102. data/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails.log +0 -82
  103. data/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML#parser-autocorrelation.dat +0 -1000
  104. data/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML#parser.dat +0 -1001
  105. data/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML.log +0 -82
  106. data/vendor/json_pure/benchmarks/generator2_benchmark.rb +0 -222
  107. data/vendor/json_pure/benchmarks/generator_benchmark.rb +0 -224
  108. data/vendor/json_pure/benchmarks/ohai.json +0 -1216
  109. data/vendor/json_pure/benchmarks/ohai.ruby +0 -1
  110. data/vendor/json_pure/benchmarks/parser2_benchmark.rb +0 -251
  111. data/vendor/json_pure/benchmarks/parser_benchmark.rb +0 -259
  112. data/vendor/json_pure/bin/edit_json.rb +0 -9
  113. data/vendor/json_pure/bin/prettify_json.rb +0 -75
  114. data/vendor/json_pure/lib/json/Array.xpm +0 -21
  115. data/vendor/json_pure/lib/json/FalseClass.xpm +0 -21
  116. data/vendor/json_pure/lib/json/Hash.xpm +0 -21
  117. data/vendor/json_pure/lib/json/Key.xpm +0 -73
  118. data/vendor/json_pure/lib/json/NilClass.xpm +0 -21
  119. data/vendor/json_pure/lib/json/Numeric.xpm +0 -28
  120. data/vendor/json_pure/lib/json/String.xpm +0 -96
  121. data/vendor/json_pure/lib/json/TrueClass.xpm +0 -21
  122. data/vendor/json_pure/lib/json/add/rails.rb +0 -58
  123. data/vendor/json_pure/lib/json/editor.rb +0 -1371
  124. data/vendor/json_pure/lib/json/json.xpm +0 -1499
  125. data/vendor/json_pure/tests/test_json_rails.rb +0 -144
@@ -0,0 +1,23 @@
1
+ #!/usr/bin/env jruby
2
+ require "rubygems"
3
+
4
+ spec = Gem::Specification.new do |s|
5
+ s.name = "json"
6
+ s.version = File.read("VERSION").chomp
7
+ s.summary = "JSON implementation for JRuby"
8
+ s.description = "A JSON implementation as a JRuby extension."
9
+ s.author = "Daniel Luz"
10
+ s.email = "dev+ruby@mernen.com"
11
+ s.homepage = "http://json-jruby.rubyforge.org/"
12
+ s.platform = 'java'
13
+ s.rubyforge_project = "json-jruby"
14
+ s.license = "Ruby"
15
+
16
+ s.files = Dir["{docs,lib,tests}/**/*"]
17
+ end
18
+
19
+ if $0 == __FILE__
20
+ Gem::Builder.new(spec).build
21
+ else
22
+ spec
23
+ end
@@ -0,0 +1,37 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = "json"
5
+ s.version = "1.8.0"
6
+
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
+ s.authors = ["Florian Frank"]
9
+ s.date = "2013-05-13"
10
+ s.description = "This is a JSON implementation as a Ruby extension in C."
11
+ s.email = "flori@ping.de"
12
+ s.extensions = ["ext/json/ext/generator/extconf.rb", "ext/json/ext/parser/extconf.rb"]
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/depend", "ext/json/ext/generator/extconf.rb", "ext/json/ext/generator/generator.c", "ext/json/ext/generator/generator.h", "ext/json/ext/parser/depend", "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.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"]
15
+ s.homepage = "http://flori.github.com/json"
16
+ s.licenses = ["Ruby"]
17
+ s.rdoc_options = ["--title", "JSON implemention for Ruby", "--main", "README.rdoc"]
18
+ s.require_paths = ["lib"]
19
+ s.rubygems_version = "2.0.3"
20
+ s.summary = "JSON Implementation for Ruby"
21
+ s.test_files = ["./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"]
22
+
23
+ if s.respond_to? :specification_version then
24
+ s.specification_version = 4
25
+
26
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
27
+ s.add_development_dependency(%q<permutation>, [">= 0"])
28
+ s.add_development_dependency(%q<sdoc>, ["~> 0.3.16"]) if RUBY_VERSION > "1.8.6"
29
+ else
30
+ s.add_dependency(%q<permutation>, [">= 0"])
31
+ s.add_dependency(%q<sdoc>, ["~> 0.3.16"]) if RUBY_VERSION > "1.8.6"
32
+ end
33
+ else
34
+ s.add_dependency(%q<permutation>, [">= 0"])
35
+ s.add_dependency(%q<sdoc>, ["~> 0.3.16"]) if RUBY_VERSION > "1.8.6"
36
+ end
37
+ end
@@ -0,0 +1,39 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = "json_pure"
5
+ s.version = "1.8.0"
6
+
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
+ s.authors = ["Florian Frank"]
9
+ s.date = "2013-05-13"
10
+ s.description = "This is a JSON implementation in pure Ruby."
11
+ s.email = "flori@ping.de"
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/depend", "ext/json/ext/generator/extconf.rb", "ext/json/ext/generator/generator.c", "ext/json/ext/generator/generator.h", "ext/json/ext/parser/depend", "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.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"]
14
+ s.homepage = "http://flori.github.com/json"
15
+ s.licenses = ["Ruby"]
16
+ s.rdoc_options = ["--title", "JSON implemention for ruby", "--main", "README.rdoc"]
17
+ s.require_paths = ["lib"]
18
+ s.rubygems_version = "2.0.3"
19
+ s.summary = "JSON Implementation for Ruby"
20
+ s.test_files = ["./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"]
21
+
22
+ if s.respond_to? :specification_version then
23
+ s.specification_version = 4
24
+
25
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
26
+ s.add_development_dependency(%q<permutation>, [">= 0"])
27
+ s.add_development_dependency(%q<sdoc>, ["~> 0.3.16"]) if RUBY_VERSION > "1.8.6"
28
+ s.add_development_dependency(%q<rake>, ["~> 0.9.2"])
29
+ else
30
+ s.add_dependency(%q<permutation>, [">= 0"])
31
+ s.add_dependency(%q<sdoc>, ["~> 0.3.16"]) if RUBY_VERSION > "1.8.6"
32
+ s.add_dependency(%q<rake>, ["~> 0.9.2"])
33
+ end
34
+ else
35
+ s.add_dependency(%q<permutation>, [">= 0"])
36
+ s.add_dependency(%q<sdoc>, ["~> 0.3.16"]) if RUBY_VERSION > "1.8.6"
37
+ s.add_dependency(%q<rake>, ["~> 0.9.2"])
38
+ end
39
+ end
@@ -1,4 +1,56 @@
1
1
  require 'json/common'
2
+
3
+ ##
4
+ # = JavaScript Object Notation (JSON)
5
+ #
6
+ # JSON is a lightweight data-interchange format. It is easy for us
7
+ # humans to read and write. Plus, equally simple for machines to generate or parse.
8
+ # JSON is completely language agnostic, making it the ideal interchange format.
9
+ #
10
+ # Built on two universally available structures:
11
+ # 1. A collection of name/value pairs. Often referred to as an _object_, hash table, record, struct, keyed list, or associative array.
12
+ # 2. An ordered list of values. More commonly called an _array_, vector, sequence or list.
13
+ #
14
+ # To read more about JSON visit: http://json.org
15
+ #
16
+ # == Parsing JSON
17
+ #
18
+ # To parse a JSON string received by another application or generated within
19
+ # your existing application:
20
+ #
21
+ # require 'json'
22
+ #
23
+ # my_hash = JSON.parse('{"hello": "goodbye"}')
24
+ # puts my_hash["hello"] => "goodbye"
25
+ #
26
+ # Notice the extra quotes <tt>''</tt> around the hash notation. Ruby expects
27
+ # the argument to be a string and can't convert objects like a hash or array.
28
+ #
29
+ # Ruby converts your string into a hash
30
+ #
31
+ # == Generating JSON
32
+ #
33
+ # Creating a JSON string for communication or serialization is
34
+ # just as simple.
35
+ #
36
+ # require 'json'
37
+ #
38
+ # my_hash = {:hello => "goodbye"}
39
+ # puts JSON.generate(my_hash) => "{\"hello\":\"goodbye\"}"
40
+ #
41
+ # Or an alternative way:
42
+ #
43
+ # require 'json'
44
+ # puts {:hello => "goodbye"}.to_json => "{\"hello\":\"goodbye\"}"
45
+ #
46
+ # <tt>JSON.generate</tt> only allows objects or arrays to be converted
47
+ # to JSON syntax. <tt>to_json</tt>, however, accepts many Ruby classes
48
+ # even though it acts only as a method for serialization:
49
+ #
50
+ # require 'json'
51
+ #
52
+ # 1.to_json => "1"
53
+ #
2
54
  module JSON
3
55
  require 'json/version'
4
56
 
@@ -0,0 +1,28 @@
1
+ unless defined?(::JSON::JSON_LOADED) and ::JSON::JSON_LOADED
2
+ require 'json'
3
+ end
4
+ defined?(::BigDecimal) or require 'bigdecimal'
5
+
6
+ class BigDecimal
7
+ # Import a JSON Marshalled object.
8
+ #
9
+ # method used for JSON marshalling support.
10
+ def self.json_create(object)
11
+ BigDecimal._load object['b']
12
+ end
13
+
14
+ # Marshal the object to JSON.
15
+ #
16
+ # method used for JSON marshalling support.
17
+ def as_json(*)
18
+ {
19
+ JSON.create_id => self.class.name,
20
+ 'b' => _dump,
21
+ }
22
+ end
23
+
24
+ # return the JSON value
25
+ def to_json(*)
26
+ as_json.to_json
27
+ end
28
+ end
@@ -0,0 +1,22 @@
1
+ unless defined?(::JSON::JSON_LOADED) and ::JSON::JSON_LOADED
2
+ require 'json'
3
+ end
4
+ defined?(::Complex) or require 'complex'
5
+
6
+ class Complex
7
+ def self.json_create(object)
8
+ Complex(object['r'], object['i'])
9
+ end
10
+
11
+ def as_json(*)
12
+ {
13
+ JSON.create_id => self.class.name,
14
+ 'r' => real,
15
+ 'i' => imag,
16
+ }
17
+ end
18
+
19
+ def to_json(*)
20
+ as_json.to_json
21
+ end
22
+ end
@@ -1,148 +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 Object.const_defined?(:JSON) and ::JSON.const_defined?(:JSON_LOADED) and
5
- ::JSON::JSON_LOADED
6
- require 'json'
7
- end
8
- require 'date'
9
-
10
- class Symbol
11
- def to_json(*a)
12
- {
13
- JSON.create_id => self.class.name,
14
- 's' => to_s,
15
- }.to_json(*a)
16
- end
17
-
18
- def self.json_create(o)
19
- o['s'].to_sym
20
- end
21
- end
22
-
23
- class Time
24
- def self.json_create(object)
25
- if usec = object.delete('u') # used to be tv_usec -> tv_nsec
26
- object['n'] = usec * 1000
27
- end
28
- if respond_to?(:tv_nsec)
29
- at(*object.values_at('s', 'n'))
30
- else
31
- at(object['s'], object['n'] / 1000)
32
- end
33
- end
34
-
35
- def to_json(*args)
36
- {
37
- JSON.create_id => self.class.name,
38
- 's' => tv_sec,
39
- 'n' => respond_to?(:tv_nsec) ? tv_nsec : tv_usec * 1000
40
- }.to_json(*args)
41
- end
42
- end
43
-
44
- class Date
45
- def self.json_create(object)
46
- civil(*object.values_at('y', 'm', 'd', 'sg'))
47
- end
48
-
49
- alias start sg unless method_defined?(:start)
50
-
51
- def to_json(*args)
52
- {
53
- JSON.create_id => self.class.name,
54
- 'y' => year,
55
- 'm' => month,
56
- 'd' => day,
57
- 'sg' => start,
58
- }.to_json(*args)
59
- end
60
- end
61
-
62
- class DateTime
63
- def self.json_create(object)
64
- args = object.values_at('y', 'm', 'd', 'H', 'M', 'S')
65
- of_a, of_b = object['of'].split('/')
66
- if of_b and of_b != '0'
67
- args << Rational(of_a.to_i, of_b.to_i)
68
- else
69
- args << of_a
70
- end
71
- args << object['sg']
72
- civil(*args)
73
- end
74
-
75
- alias start sg unless method_defined?(:start)
76
-
77
- def to_json(*args)
78
- {
79
- JSON.create_id => self.class.name,
80
- 'y' => year,
81
- 'm' => month,
82
- 'd' => day,
83
- 'H' => hour,
84
- 'M' => min,
85
- 'S' => sec,
86
- 'of' => offset.to_s,
87
- 'sg' => start,
88
- }.to_json(*args)
89
- end
90
- end
91
-
92
- class Range
93
- def self.json_create(object)
94
- new(*object['a'])
95
- end
96
-
97
- def to_json(*args)
98
- {
99
- JSON.create_id => self.class.name,
100
- 'a' => [ first, last, exclude_end? ]
101
- }.to_json(*args)
102
- end
103
- end
104
-
105
- class Struct
106
- def self.json_create(object)
107
- new(*object['v'])
108
- end
109
-
110
- def to_json(*args)
111
- klass = self.class.name
112
- klass.to_s.empty? and raise JSON::JSONError, "Only named structs are supported!"
113
- {
114
- JSON.create_id => klass,
115
- 'v' => values,
116
- }.to_json(*args)
117
- end
118
- end
119
-
120
- class Exception
121
- def self.json_create(object)
122
- result = new(object['m'])
123
- result.set_backtrace object['b']
124
- result
125
- end
126
-
127
- def to_json(*args)
128
- {
129
- JSON.create_id => self.class.name,
130
- 'm' => message,
131
- 'b' => backtrace,
132
- }.to_json(*args)
133
- end
134
- end
135
-
136
- class Regexp
137
- def self.json_create(object)
138
- new(object['s'], object['o'])
139
- end
140
-
141
- def to_json(*)
142
- {
143
- JSON.create_id => self.class.name,
144
- 'o' => options,
145
- 's' => source,
146
- }.to_json
147
- end
148
- 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
+