json 1.8.5 → 2.6.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (107) hide show
  1. checksums.yaml +5 -5
  2. data/{CHANGES → CHANGES.md} +248 -95
  3. data/LICENSE +56 -0
  4. data/README.md +188 -108
  5. data/VERSION +1 -1
  6. data/ext/json/ext/fbuffer/fbuffer.h +0 -3
  7. data/ext/json/ext/generator/generator.c +229 -113
  8. data/ext/json/ext/generator/generator.h +5 -4
  9. data/ext/json/ext/parser/extconf.rb +29 -0
  10. data/ext/json/ext/parser/parser.c +3022 -1915
  11. data/ext/json/ext/parser/parser.h +10 -6
  12. data/ext/json/ext/parser/parser.rl +210 -187
  13. data/ext/json/extconf.rb +1 -1
  14. data/json.gemspec +0 -0
  15. data/lib/json/add/bigdecimal.rb +3 -2
  16. data/lib/json/add/complex.rb +4 -4
  17. data/lib/json/add/core.rb +1 -0
  18. data/lib/json/add/date.rb +1 -1
  19. data/lib/json/add/date_time.rb +1 -1
  20. data/lib/json/add/exception.rb +1 -1
  21. data/lib/json/add/ostruct.rb +3 -3
  22. data/lib/json/add/range.rb +1 -1
  23. data/lib/json/add/rational.rb +3 -3
  24. data/lib/json/add/regexp.rb +3 -3
  25. data/lib/json/add/set.rb +29 -0
  26. data/lib/json/add/struct.rb +1 -1
  27. data/lib/json/add/symbol.rb +1 -1
  28. data/lib/json/add/time.rb +1 -1
  29. data/lib/json/common.rb +381 -162
  30. data/lib/json/ext.rb +0 -6
  31. data/lib/json/generic_object.rb +5 -4
  32. data/lib/json/pure/generator.rb +73 -124
  33. data/lib/json/pure/parser.rb +64 -86
  34. data/lib/json/pure.rb +2 -8
  35. data/lib/json/version.rb +2 -1
  36. data/lib/json.rb +550 -29
  37. metadata +20 -127
  38. data/.gitignore +0 -17
  39. data/.travis.yml +0 -18
  40. data/Gemfile +0 -7
  41. data/README-json-jruby.markdown +0 -33
  42. data/Rakefile +0 -402
  43. data/TODO +0 -1
  44. data/data/example.json +0 -1
  45. data/data/index.html +0 -38
  46. data/data/prototype.js +0 -4184
  47. data/diagrams/.keep +0 -0
  48. data/install.rb +0 -23
  49. data/java/src/json/ext/ByteListTranscoder.java +0 -166
  50. data/java/src/json/ext/Generator.java +0 -446
  51. data/java/src/json/ext/GeneratorMethods.java +0 -231
  52. data/java/src/json/ext/GeneratorService.java +0 -42
  53. data/java/src/json/ext/GeneratorState.java +0 -542
  54. data/java/src/json/ext/OptionsReader.java +0 -113
  55. data/java/src/json/ext/Parser.java +0 -2644
  56. data/java/src/json/ext/Parser.rl +0 -968
  57. data/java/src/json/ext/ParserService.java +0 -34
  58. data/java/src/json/ext/RuntimeInfo.java +0 -120
  59. data/java/src/json/ext/StringDecoder.java +0 -166
  60. data/java/src/json/ext/StringEncoder.java +0 -111
  61. data/java/src/json/ext/Utils.java +0 -88
  62. data/json-java.gemspec +0 -38
  63. data/json_pure.gemspec +0 -37
  64. data/lib/json/ext/.keep +0 -0
  65. data/tests/fixtures/fail1.json +0 -1
  66. data/tests/fixtures/fail10.json +0 -1
  67. data/tests/fixtures/fail11.json +0 -1
  68. data/tests/fixtures/fail12.json +0 -1
  69. data/tests/fixtures/fail13.json +0 -1
  70. data/tests/fixtures/fail14.json +0 -1
  71. data/tests/fixtures/fail18.json +0 -1
  72. data/tests/fixtures/fail19.json +0 -1
  73. data/tests/fixtures/fail2.json +0 -1
  74. data/tests/fixtures/fail20.json +0 -1
  75. data/tests/fixtures/fail21.json +0 -1
  76. data/tests/fixtures/fail22.json +0 -1
  77. data/tests/fixtures/fail23.json +0 -1
  78. data/tests/fixtures/fail24.json +0 -1
  79. data/tests/fixtures/fail25.json +0 -1
  80. data/tests/fixtures/fail27.json +0 -2
  81. data/tests/fixtures/fail28.json +0 -2
  82. data/tests/fixtures/fail3.json +0 -1
  83. data/tests/fixtures/fail4.json +0 -1
  84. data/tests/fixtures/fail5.json +0 -1
  85. data/tests/fixtures/fail6.json +0 -1
  86. data/tests/fixtures/fail7.json +0 -1
  87. data/tests/fixtures/fail8.json +0 -1
  88. data/tests/fixtures/fail9.json +0 -1
  89. data/tests/fixtures/pass1.json +0 -56
  90. data/tests/fixtures/pass15.json +0 -1
  91. data/tests/fixtures/pass16.json +0 -1
  92. data/tests/fixtures/pass17.json +0 -1
  93. data/tests/fixtures/pass2.json +0 -1
  94. data/tests/fixtures/pass26.json +0 -1
  95. data/tests/fixtures/pass3.json +0 -6
  96. data/tests/setup_variant.rb +0 -11
  97. data/tests/test_json.rb +0 -519
  98. data/tests/test_json_addition.rb +0 -196
  99. data/tests/test_json_encoding.rb +0 -65
  100. data/tests/test_json_fixtures.rb +0 -35
  101. data/tests/test_json_generate.rb +0 -348
  102. data/tests/test_json_generic_object.rb +0 -75
  103. data/tests/test_json_string_matching.rb +0 -39
  104. data/tests/test_json_unicode.rb +0 -72
  105. data/tools/diff.sh +0 -18
  106. data/tools/fuzz.rb +0 -139
  107. data/tools/server.rb +0 -62
data/ext/json/extconf.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  require 'mkmf'
2
- create_makefile('json')
3
2
 
3
+ create_makefile('json')
data/json.gemspec CHANGED
Binary file
@@ -1,3 +1,4 @@
1
+ #frozen_string_literal: false
1
2
  unless defined?(::JSON::JSON_LOADED) and ::JSON::JSON_LOADED
2
3
  require 'json'
3
4
  end
@@ -22,7 +23,7 @@ class BigDecimal
22
23
  end
23
24
 
24
25
  # return the JSON value
25
- def to_json(*)
26
- as_json.to_json
26
+ def to_json(*args)
27
+ as_json.to_json(*args)
27
28
  end
28
29
  end
@@ -1,7 +1,7 @@
1
+ #frozen_string_literal: false
1
2
  unless defined?(::JSON::JSON_LOADED) and ::JSON::JSON_LOADED
2
3
  require 'json'
3
4
  end
4
- defined?(::Complex) or require 'complex'
5
5
 
6
6
  class Complex
7
7
 
@@ -22,7 +22,7 @@ class Complex
22
22
  end
23
23
 
24
24
  # Stores class name (Complex) along with real value <tt>r</tt> and imaginary value <tt>i</tt> as JSON string
25
- def to_json(*)
26
- as_json.to_json
25
+ def to_json(*args)
26
+ as_json.to_json(*args)
27
27
  end
28
- end
28
+ end
data/lib/json/add/core.rb CHANGED
@@ -1,3 +1,4 @@
1
+ #frozen_string_literal: false
1
2
  # This file requires the implementations of ruby core's custom objects for
2
3
  # serialisation/deserialisation.
3
4
 
data/lib/json/add/date.rb CHANGED
@@ -1,9 +1,9 @@
1
+ #frozen_string_literal: false
1
2
  unless defined?(::JSON::JSON_LOADED) and ::JSON::JSON_LOADED
2
3
  require 'json'
3
4
  end
4
5
  require 'date'
5
6
 
6
- # Date serialization/deserialization
7
7
  class Date
8
8
 
9
9
  # Deserializes JSON string by converting Julian year <tt>y</tt>, month
@@ -1,9 +1,9 @@
1
+ #frozen_string_literal: false
1
2
  unless defined?(::JSON::JSON_LOADED) and ::JSON::JSON_LOADED
2
3
  require 'json'
3
4
  end
4
5
  require 'date'
5
6
 
6
- # DateTime serialization/deserialization
7
7
  class DateTime
8
8
 
9
9
  # Deserializes JSON string by converting year <tt>y</tt>, month <tt>m</tt>,
@@ -1,8 +1,8 @@
1
+ #frozen_string_literal: false
1
2
  unless defined?(::JSON::JSON_LOADED) and ::JSON::JSON_LOADED
2
3
  require 'json'
3
4
  end
4
5
 
5
- # Exception serialization/deserialization
6
6
  class Exception
7
7
 
8
8
  # Deserializes JSON string by constructing new Exception object with message
@@ -1,13 +1,13 @@
1
+ #frozen_string_literal: false
1
2
  unless defined?(::JSON::JSON_LOADED) and ::JSON::JSON_LOADED
2
3
  require 'json'
3
4
  end
4
5
  require 'ostruct'
5
6
 
6
- # OpenStruct serialization/deserialization
7
7
  class OpenStruct
8
8
 
9
9
  # Deserializes JSON string by constructing new Struct object with values
10
- # <tt>v</tt> serialized by <tt>to_json</tt>.
10
+ # <tt>t</tt> serialized by <tt>to_json</tt>.
11
11
  def self.json_create(object)
12
12
  new(object['t'] || object[:t])
13
13
  end
@@ -23,7 +23,7 @@ class OpenStruct
23
23
  }
24
24
  end
25
25
 
26
- # Stores class name (OpenStruct) with this struct's values <tt>v</tt> as a
26
+ # Stores class name (OpenStruct) with this struct's values <tt>t</tt> as a
27
27
  # JSON string.
28
28
  def to_json(*args)
29
29
  as_json.to_json(*args)
@@ -1,8 +1,8 @@
1
+ #frozen_string_literal: false
1
2
  unless defined?(::JSON::JSON_LOADED) and ::JSON::JSON_LOADED
2
3
  require 'json'
3
4
  end
4
5
 
5
- # Range serialization/deserialization
6
6
  class Range
7
7
 
8
8
  # Deserializes JSON string by constructing new Range object with arguments
@@ -1,7 +1,7 @@
1
+ #frozen_string_literal: false
1
2
  unless defined?(::JSON::JSON_LOADED) and ::JSON::JSON_LOADED
2
3
  require 'json'
3
4
  end
4
- defined?(::Rational) or require 'rational'
5
5
 
6
6
  class Rational
7
7
  # Deserializes JSON string by converting numerator value <tt>n</tt>,
@@ -21,7 +21,7 @@ class Rational
21
21
  end
22
22
 
23
23
  # Stores class name (Rational) along with numerator value <tt>n</tt> and denominator value <tt>d</tt> as JSON string
24
- def to_json(*)
25
- as_json.to_json
24
+ def to_json(*args)
25
+ as_json.to_json(*args)
26
26
  end
27
27
  end
@@ -1,8 +1,8 @@
1
+ #frozen_string_literal: false
1
2
  unless defined?(::JSON::JSON_LOADED) and ::JSON::JSON_LOADED
2
3
  require 'json'
3
4
  end
4
5
 
5
- # Regexp serialization/deserialization
6
6
  class Regexp
7
7
 
8
8
  # Deserializes JSON string by constructing new Regexp object with source
@@ -24,7 +24,7 @@ class Regexp
24
24
 
25
25
  # Stores class name (Regexp) with options <tt>o</tt> and source <tt>s</tt>
26
26
  # (Regexp or String) as JSON string
27
- def to_json(*)
28
- as_json.to_json
27
+ def to_json(*args)
28
+ as_json.to_json(*args)
29
29
  end
30
30
  end
@@ -0,0 +1,29 @@
1
+ unless defined?(::JSON::JSON_LOADED) and ::JSON::JSON_LOADED
2
+ require 'json'
3
+ end
4
+ defined?(::Set) or require 'set'
5
+
6
+ class Set
7
+ # Import a JSON Marshalled object.
8
+ #
9
+ # method used for JSON marshalling support.
10
+ def self.json_create(object)
11
+ new object['a']
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
+ 'a' => to_a,
21
+ }
22
+ end
23
+
24
+ # return the JSON value
25
+ def to_json(*args)
26
+ as_json.to_json(*args)
27
+ end
28
+ end
29
+
@@ -1,8 +1,8 @@
1
+ #frozen_string_literal: false
1
2
  unless defined?(::JSON::JSON_LOADED) and ::JSON::JSON_LOADED
2
3
  require 'json'
3
4
  end
4
5
 
5
- # Struct serialization/deserialization
6
6
  class Struct
7
7
 
8
8
  # Deserializes JSON string by constructing new Struct object with values
@@ -1,8 +1,8 @@
1
+ #frozen_string_literal: false
1
2
  unless defined?(::JSON::JSON_LOADED) and ::JSON::JSON_LOADED
2
3
  require 'json'
3
4
  end
4
5
 
5
- # Symbol serialization/deserialization
6
6
  class Symbol
7
7
  # Returns a hash, that will be turned into a JSON object and represent this
8
8
  # object.
data/lib/json/add/time.rb CHANGED
@@ -1,8 +1,8 @@
1
+ #frozen_string_literal: false
1
2
  unless defined?(::JSON::JSON_LOADED) and ::JSON::JSON_LOADED
2
3
  require 'json'
3
4
  end
4
5
 
5
- # Time serialization/deserialization
6
6
  class Time
7
7
 
8
8
  # Deserializes JSON string by converting time since epoch to Time