json 1.8.3 → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +2 -0
  3. data/.travis.yml +9 -11
  4. data/{CHANGES → CHANGES.md} +186 -90
  5. data/Gemfile +10 -6
  6. data/{COPYING-json-jruby → LICENSE} +5 -6
  7. data/{README-json-jruby.markdown → README-json-jruby.md} +0 -0
  8. data/{README.rdoc → README.md} +185 -134
  9. data/Rakefile +41 -40
  10. data/VERSION +1 -1
  11. data/ext/json/ext/fbuffer/fbuffer.h +0 -3
  12. data/ext/json/ext/generator/generator.c +142 -101
  13. data/ext/json/ext/generator/generator.h +7 -2
  14. data/ext/json/ext/parser/extconf.rb +3 -0
  15. data/ext/json/ext/parser/parser.c +383 -463
  16. data/ext/json/ext/parser/parser.h +4 -5
  17. data/ext/json/ext/parser/parser.rl +141 -184
  18. data/ext/json/extconf.rb +0 -1
  19. data/java/src/json/ext/ByteListTranscoder.java +1 -2
  20. data/java/src/json/ext/Generator.java +44 -22
  21. data/java/src/json/ext/GeneratorMethods.java +1 -2
  22. data/java/src/json/ext/GeneratorService.java +1 -2
  23. data/java/src/json/ext/GeneratorState.java +3 -56
  24. data/java/src/json/ext/OptionsReader.java +2 -3
  25. data/java/src/json/ext/Parser.java +132 -415
  26. data/java/src/json/ext/Parser.rl +48 -124
  27. data/java/src/json/ext/ParserService.java +1 -2
  28. data/java/src/json/ext/RuntimeInfo.java +1 -6
  29. data/java/src/json/ext/StringDecoder.java +1 -2
  30. data/java/src/json/ext/StringEncoder.java +5 -0
  31. data/java/src/json/ext/Utils.java +1 -2
  32. data/json-java.gemspec +16 -2
  33. data/json.gemspec +0 -0
  34. data/json_pure.gemspec +24 -26
  35. data/lib/json/add/bigdecimal.rb +3 -2
  36. data/lib/json/add/complex.rb +4 -3
  37. data/lib/json/add/core.rb +1 -0
  38. data/lib/json/add/date.rb +1 -1
  39. data/lib/json/add/date_time.rb +1 -1
  40. data/lib/json/add/exception.rb +1 -1
  41. data/lib/json/add/ostruct.rb +3 -3
  42. data/lib/json/add/range.rb +1 -1
  43. data/lib/json/add/rational.rb +3 -2
  44. data/lib/json/add/regexp.rb +3 -3
  45. data/lib/json/add/set.rb +29 -0
  46. data/lib/json/add/struct.rb +1 -1
  47. data/lib/json/add/symbol.rb +1 -1
  48. data/lib/json/add/time.rb +1 -1
  49. data/lib/json/common.rb +26 -54
  50. data/lib/json/ext.rb +0 -6
  51. data/lib/json/generic_object.rb +5 -4
  52. data/lib/json/pure/generator.rb +63 -126
  53. data/lib/json/pure/parser.rb +41 -81
  54. data/lib/json/pure.rb +2 -8
  55. data/lib/json/version.rb +2 -1
  56. data/lib/json.rb +1 -0
  57. data/references/rfc7159.txt +899 -0
  58. data/tests/fixtures/obsolete_fail1.json +1 -0
  59. data/tests/{test_json_addition.rb → json_addition_test.rb} +32 -25
  60. data/tests/json_common_interface_test.rb +126 -0
  61. data/tests/json_encoding_test.rb +107 -0
  62. data/tests/json_ext_parser_test.rb +15 -0
  63. data/tests/{test_json_fixtures.rb → json_fixtures_test.rb} +5 -8
  64. data/tests/{test_json_generate.rb → json_generator_test.rb} +123 -39
  65. data/tests/{test_json_generic_object.rb → json_generic_object_test.rb} +15 -8
  66. data/tests/json_parser_test.rb +472 -0
  67. data/tests/json_string_matching_test.rb +38 -0
  68. data/tests/{setup_variant.rb → test_helper.rb} +6 -0
  69. data/tools/diff.sh +18 -0
  70. data/tools/fuzz.rb +1 -9
  71. metadata +30 -47
  72. data/COPYING +0 -58
  73. data/GPL +0 -340
  74. data/TODO +0 -1
  75. data/data/example.json +0 -1
  76. data/data/index.html +0 -38
  77. data/data/prototype.js +0 -4184
  78. data/tests/fixtures/fail1.json +0 -1
  79. data/tests/test_json.rb +0 -553
  80. data/tests/test_json_encoding.rb +0 -65
  81. data/tests/test_json_string_matching.rb +0 -39
  82. data/tests/test_json_unicode.rb +0 -72
@@ -1,8 +1,7 @@
1
1
  /*
2
2
  * This code is copyrighted work by Daniel Luz <dev at mernen dot com>.
3
3
  *
4
- * Distributed under the Ruby and GPLv2 licenses; see COPYING and GPL files
5
- * for details.
4
+ * Distributed under the Ruby license: https://www.ruby-lang.org/en/about/license.txt
6
5
  */
7
6
  package json.ext;
8
7
 
@@ -51,9 +50,9 @@ public class Parser extends RubyObject {
51
50
  private int maxNesting;
52
51
  private boolean allowNaN;
53
52
  private boolean symbolizeNames;
54
- private boolean quirksMode;
55
53
  private RubyClass objectClass;
56
54
  private RubyClass arrayClass;
55
+ private RubyClass decimalClass;
57
56
  private RubyHash match_string;
58
57
 
59
58
  private static final int DEFAULT_MAX_NESTING = 100;
@@ -122,10 +121,6 @@ public class Parser extends RubyObject {
122
121
  * <dd>If set to <code>true</code>, returns symbols for the names (keys) in
123
122
  * a JSON object. Otherwise strings are returned, which is also the default.
124
123
  *
125
- * <dt><code>:quirks_mode?</code>
126
- * <dd>If set to <code>true</code>, if the parse is in quirks_mode, false
127
- * otherwise.
128
- *
129
124
  * <dt><code>:create_additions</code>
130
125
  * <dd>If set to <code>false</code>, the Parser doesn't create additions
131
126
  * even if a matching class and <code>create_id</code> was found. This option
@@ -137,9 +132,10 @@ public class Parser extends RubyObject {
137
132
  * <dt><code>:array_class</code>
138
133
  * <dd>Defaults to Array.
139
134
  *
140
- * <dt><code>:quirks_mode</code>
141
- * <dd>Enables quirks_mode for parser, that is for example parsing single
142
- * JSON values instead of documents is possible.
135
+ * <dt><code>:decimal_class</code>
136
+ * <dd>Specifies which class to use instead of the default (Float) when
137
+ * parsing decimal numbers. This class must accept a single string argument
138
+ * in its constructor.
143
139
  * </dl>
144
140
  */
145
141
  @JRubyMethod(name = "new", required = 1, optional = 1, meta = true)
@@ -162,15 +158,21 @@ public class Parser extends RubyObject {
162
158
  this.maxNesting = opts.getInt("max_nesting", DEFAULT_MAX_NESTING);
163
159
  this.allowNaN = opts.getBool("allow_nan", false);
164
160
  this.symbolizeNames = opts.getBool("symbolize_names", false);
165
- this.quirksMode = opts.getBool("quirks_mode", false);
166
161
  this.createId = opts.getString("create_id", getCreateId(context));
167
162
  this.createAdditions = opts.getBool("create_additions", false);
168
163
  this.objectClass = opts.getClass("object_class", runtime.getHash());
169
164
  this.arrayClass = opts.getClass("array_class", runtime.getArray());
165
+ this.decimalClass = opts.getClass("decimal_class", null);
170
166
  this.match_string = opts.getHash("match_string");
171
167
 
168
+ if(symbolizeNames && createAdditions) {
169
+ throw runtime.newArgumentError(
170
+ "options :symbolize_names and :create_additions cannot be " +
171
+ " used in conjunction"
172
+ );
173
+ }
172
174
  this.vSource = args[0].convertToString();
173
- if (!quirksMode) this.vSource = convertEncoding(context, vSource);
175
+ this.vSource = convertEncoding(context, vSource);
174
176
 
175
177
  return this;
176
178
  }
@@ -181,33 +183,16 @@ public class Parser extends RubyObject {
181
183
  * Returns the source string if no conversion is needed.
182
184
  */
183
185
  private RubyString convertEncoding(ThreadContext context, RubyString source) {
184
- ByteList bl = source.getByteList();
185
- int len = bl.length();
186
- if (len < 2) {
187
- throw Utils.newException(context, Utils.M_PARSER_ERROR,
188
- "A JSON text must at least contain two octets!");
189
- }
190
-
191
- if (info.encodingsSupported()) {
192
- RubyEncoding encoding = (RubyEncoding)source.encoding(context);
193
- if (encoding != info.ascii8bit.get()) {
194
- return (RubyString)source.encode(context, info.utf8.get());
195
- }
196
-
197
- String sniffedEncoding = sniffByteList(bl);
198
- if (sniffedEncoding == null) return source; // assume UTF-8
199
- return reinterpretEncoding(context, source, sniffedEncoding);
200
- }
201
-
202
- String sniffedEncoding = sniffByteList(bl);
203
- if (sniffedEncoding == null) return source; // assume UTF-8
204
- Ruby runtime = context.getRuntime();
205
- return (RubyString)info.jsonModule.get().
206
- callMethod(context, "iconv",
207
- new IRubyObject[] {
208
- runtime.newString("utf-8"),
209
- runtime.newString(sniffedEncoding),
210
- source});
186
+ RubyEncoding encoding = (RubyEncoding)source.encoding(context);
187
+ if (encoding == info.ascii8bit.get()) {
188
+ if (source.isFrozen()) {
189
+ source = (RubyString) source.dup();
190
+ }
191
+ source.force_encoding(context, info.utf8.get());
192
+ } else {
193
+ source = (RubyString) source.encode(context, info.utf8.get());
194
+ }
195
+ return source;
211
196
  }
212
197
 
213
198
  /**
@@ -260,17 +245,6 @@ public class Parser extends RubyObject {
260
245
  return checkAndGetSource().dup();
261
246
  }
262
247
 
263
- /**
264
- * <code>Parser#quirks_mode?()</code>
265
- *
266
- * <p>If set to <code>true</code>, if the parse is in quirks_mode, false
267
- * otherwise.
268
- */
269
- @JRubyMethod(name = "quirks_mode?")
270
- public IRubyObject quirks_mode_p(ThreadContext context) {
271
- return context.getRuntime().newBoolean(quirksMode);
272
- }
273
-
274
248
  public RubyString checkAndGetSource() {
275
249
  if (vSource != null) {
276
250
  return vSource;
@@ -394,7 +368,7 @@ public class Parser extends RubyObject {
394
368
  }
395
369
  }
396
370
  action parse_number {
397
- if (pe > fpc + 9 - (parser.quirksMode ? 1 : 0) &&
371
+ if (pe > fpc + 8 &&
398
372
  absSubSequence(fpc, fpc + 9).equals(JSON_MINUS_INFINITY)) {
399
373
 
400
374
  if (parser.allowNaN) {
@@ -521,13 +495,13 @@ public class Parser extends RubyObject {
521
495
 
522
496
  return p;
523
497
  }
524
-
498
+
525
499
  RubyInteger createInteger(int p, int new_p) {
526
500
  Ruby runtime = getRuntime();
527
501
  ByteList num = absSubSequence(p, new_p);
528
502
  return bytesToInum(runtime, num);
529
503
  }
530
-
504
+
531
505
  RubyInteger bytesToInum(Ruby runtime, ByteList num) {
532
506
  return runtime.is1_9() ?
533
507
  ConvertBytes.byteListToInum19(runtime, num, 10, true) :
@@ -557,7 +531,9 @@ public class Parser extends RubyObject {
557
531
  res.update(null, p);
558
532
  return;
559
533
  }
560
- RubyFloat number = createFloat(p, new_p);
534
+ IRubyObject number = parser.decimalClass == null ?
535
+ createFloat(p, new_p) : createCustomDecimal(p, new_p);
536
+
561
537
  res.update(number, new_p + 1);
562
538
  return;
563
539
  }
@@ -572,16 +548,23 @@ public class Parser extends RubyObject {
572
548
  if (cs < JSON_float_first_final) {
573
549
  return -1;
574
550
  }
575
-
551
+
576
552
  return p;
577
553
  }
578
-
554
+
579
555
  RubyFloat createFloat(int p, int new_p) {
580
556
  Ruby runtime = getRuntime();
581
557
  ByteList num = absSubSequence(p, new_p);
582
558
  return RubyFloat.newFloat(runtime, dc.parse(num, true, runtime.is1_9()));
583
559
  }
584
560
 
561
+ IRubyObject createCustomDecimal(int p, int new_p) {
562
+ Ruby runtime = getRuntime();
563
+ ByteList num = absSubSequence(p, new_p);
564
+ IRubyObject numString = runtime.newString(num.toString());
565
+ return parser.decimalClass.callMethod(context, "new", numString);
566
+ }
567
+
585
568
  %%{
586
569
  machine JSON_string;
587
570
  include JSON_common;
@@ -624,11 +607,11 @@ public class Parser extends RubyObject {
624
607
  %% write exec;
625
608
 
626
609
  if (parser.createAdditions) {
627
- RubyHash match_string = parser.match_string;
628
- if (match_string != null) {
610
+ RubyHash matchString = parser.match_string;
611
+ if (matchString != null) {
629
612
  final IRubyObject[] memoArray = { result, null };
630
613
  try {
631
- match_string.visitAll(new RubyHash.Visitor() {
614
+ matchString.visitAll(new RubyHash.Visitor() {
632
615
  @Override
633
616
  public void visit(IRubyObject pattern, IRubyObject klass) {
634
617
  if (pattern.callMethod(context, "===", memoArray[0]).isTrue()) {
@@ -648,8 +631,8 @@ public class Parser extends RubyObject {
648
631
  }
649
632
  }
650
633
 
651
- if (cs >= JSON_string_first_final && result != null) {
652
- if (info.encodingsSupported() && result instanceof RubyString) {
634
+ if (cs >= JSON_string_first_final && result != null) {
635
+ if (result instanceof RubyString) {
653
636
  ((RubyString)result).force_encoding(context, info.utf8.get());
654
637
  }
655
638
  res.update(result, p + 1);
@@ -766,7 +749,7 @@ public class Parser extends RubyObject {
766
749
  fhold;
767
750
  fbreak;
768
751
  }
769
-
752
+
770
753
  pair = ignore* begin_name >parse_name ignore* name_separator
771
754
  ignore* begin_value >parse_value;
772
755
  next_pair = ignore* value_separator pair;
@@ -836,60 +819,6 @@ public class Parser extends RubyObject {
836
819
 
837
820
  write data;
838
821
 
839
- action parse_object {
840
- currentNesting = 1;
841
- parseObject(res, fpc, pe);
842
- if (res.result == null) {
843
- fhold;
844
- fbreak;
845
- } else {
846
- result = res.result;
847
- fexec res.p;
848
- }
849
- }
850
-
851
- action parse_array {
852
- currentNesting = 1;
853
- parseArray(res, fpc, pe);
854
- if (res.result == null) {
855
- fhold;
856
- fbreak;
857
- } else {
858
- result = res.result;
859
- fexec res.p;
860
- }
861
- }
862
-
863
- main := ignore*
864
- ( begin_object >parse_object
865
- | begin_array >parse_array )
866
- ignore*;
867
- }%%
868
-
869
- public IRubyObject parseStrict() {
870
- int cs = EVIL;
871
- int p, pe;
872
- IRubyObject result = null;
873
- ParserResult res = new ParserResult();
874
-
875
- %% write init;
876
- p = byteList.begin();
877
- pe = p + byteList.length();
878
- %% write exec;
879
-
880
- if (cs >= JSON_first_final && p == pe) {
881
- return result;
882
- } else {
883
- throw unexpectedToken(p, pe);
884
- }
885
- }
886
-
887
- %%{
888
- machine JSON_quirks_mode;
889
- include JSON_common;
890
-
891
- write data;
892
-
893
822
  action parse_value {
894
823
  parseValue(res, fpc, pe);
895
824
  if (res.result == null) {
@@ -906,7 +835,7 @@ public class Parser extends RubyObject {
906
835
  ignore*;
907
836
  }%%
908
837
 
909
- public IRubyObject parseQuirksMode() {
838
+ public IRubyObject parseImplemetation() {
910
839
  int cs = EVIL;
911
840
  int p, pe;
912
841
  IRubyObject result = null;
@@ -917,7 +846,7 @@ public class Parser extends RubyObject {
917
846
  pe = p + byteList.length();
918
847
  %% write exec;
919
848
 
920
- if (cs >= JSON_quirks_mode_first_final && p == pe) {
849
+ if (cs >= JSON_first_final && p == pe) {
921
850
  return result;
922
851
  } else {
923
852
  throw unexpectedToken(p, pe);
@@ -925,12 +854,7 @@ public class Parser extends RubyObject {
925
854
  }
926
855
 
927
856
  public IRubyObject parse() {
928
- if (parser.quirksMode) {
929
- return parseQuirksMode();
930
- } else {
931
- return parseStrict();
932
- }
933
-
857
+ return parseImplemetation();
934
858
  }
935
859
 
936
860
  /**
@@ -1,8 +1,7 @@
1
1
  /*
2
2
  * This code is copyrighted work by Daniel Luz <dev at mernen dot com>.
3
3
  *
4
- * Distributed under the Ruby and GPLv2 licenses; see COPYING and GPL files
5
- * for details.
4
+ * Distributed under the Ruby license: https://www.ruby-lang.org/en/about/license.txt
6
5
  */
7
6
  package json.ext;
8
7
 
@@ -1,8 +1,7 @@
1
1
  /*
2
2
  * This code is copyrighted work by Daniel Luz <dev at mernen dot com>.
3
3
  *
4
- * Distributed under the Ruby and GPLv2 licenses; see COPYING and GPL files
5
- * for details.
4
+ * Distributed under the Ruby license: https://www.ruby-lang.org/en/about/license.txt
6
5
  */
7
6
  package json.ext;
8
7
 
@@ -91,10 +90,6 @@ final class RuntimeInfo {
91
90
  }
92
91
  }
93
92
 
94
- public boolean encodingsSupported() {
95
- return utf8 != null && utf8.get() != null;
96
- }
97
-
98
93
  public RubyEncoding getEncoding(ThreadContext context, String name) {
99
94
  synchronized (encodings) {
100
95
  WeakReference<RubyEncoding> encoding = encodings.get(name);
@@ -1,8 +1,7 @@
1
1
  /*
2
2
  * This code is copyrighted work by Daniel Luz <dev at mernen dot com>.
3
3
  *
4
- * Distributed under the Ruby and GPLv2 licenses; see COPYING and GPL files
5
- * for details.
4
+ * Distributed under the Ruby license: https://www.ruby-lang.org/en/about/license.txt
6
5
  */
7
6
  package json.ext;
8
7
 
@@ -1,3 +1,8 @@
1
+ /*
2
+ * This code is copyrighted work by Daniel Luz <dev at mernen dot com>.
3
+ *
4
+ * Distributed under the Ruby license: https://www.ruby-lang.org/en/about/license.txt
5
+ */
1
6
  package json.ext;
2
7
 
3
8
  import org.jruby.exceptions.RaiseException;
@@ -1,8 +1,7 @@
1
1
  /*
2
2
  * This code is copyrighted work by Daniel Luz <dev at mernen dot com>.
3
3
  *
4
- * Distributed under the Ruby and GPLv2 licenses; see COPYING and GPL files
5
- * for details.
4
+ * Distributed under the Ruby license: https://www.ruby-lang.org/en/about/license.txt
6
5
  */
7
6
  package json.ext;
8
7
 
data/json-java.gemspec CHANGED
@@ -8,12 +8,26 @@ spec = Gem::Specification.new do |s|
8
8
  s.description = "A JSON implementation as a JRuby extension."
9
9
  s.author = "Daniel Luz"
10
10
  s.email = "dev+ruby@mernen.com"
11
- s.homepage = "http://json-jruby.rubyforge.org/"
11
+ s.homepage = "http://flori.github.com/json"
12
12
  s.platform = 'java'
13
- s.rubyforge_project = "json-jruby"
14
13
  s.licenses = ["Ruby"]
15
14
 
16
15
  s.files = Dir["{docs,lib,tests}/**/*"]
16
+
17
+ if s.respond_to? :specification_version then
18
+ s.specification_version = 4
19
+
20
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
21
+ s.add_development_dependency(%q<rake>, [">= 0"])
22
+ s.add_development_dependency(%q<test-unit>, ["~> 2.0"])
23
+ else
24
+ s.add_dependency(%q<rake>, [">= 0"])
25
+ s.add_dependency(%q<test-unit>, ["~> 2.0"])
26
+ end
27
+ else
28
+ s.add_dependency(%q<rake>, [">= 0"])
29
+ s.add_dependency(%q<test-unit>, ["~> 2.0"])
30
+ end
17
31
  end
18
32
 
19
33
  if $0 == __FILE__
data/json.gemspec CHANGED
Binary file
data/json_pure.gemspec CHANGED
@@ -1,40 +1,38 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # stub: json_pure 1.8.3 ruby lib
2
+ # stub: json_pure 2.3.0 ruby lib
3
3
 
4
4
  Gem::Specification.new do |s|
5
- s.name = "json_pure"
6
- s.version = "1.8.3"
5
+ s.name = "json_pure".freeze
6
+ s.version = "2.3.0"
7
7
 
8
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
9
- s.require_paths = ["lib"]
10
- s.authors = ["Florian Frank"]
11
- s.date = "2015-06-01"
12
- s.description = "This is a JSON implementation in pure Ruby."
13
- s.email = "flori@ping.de"
14
- s.extra_rdoc_files = ["README.rdoc"]
15
- s.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", ".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", "ext/json/extconf.rb", "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"]
16
- s.homepage = "http://flori.github.com/json"
17
- s.licenses = ["Ruby"]
18
- s.rdoc_options = ["--title", "JSON implemention for ruby", "--main", "README.rdoc"]
19
- s.rubygems_version = "2.4.6"
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"]
8
+ s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
9
+ s.require_paths = ["lib".freeze]
10
+ s.authors = ["Florian Frank".freeze]
11
+ s.date = "2019-12-11"
12
+ s.description = "This is a JSON implementation in pure Ruby.".freeze
13
+ s.email = "flori@ping.de".freeze
14
+ s.extra_rdoc_files = ["README.md".freeze]
15
+ s.files = ["./tests/test_helper.rb".freeze, ".gitignore".freeze, ".travis.yml".freeze, "CHANGES.md".freeze, "Gemfile".freeze, "LICENSE".freeze, "README-json-jruby.md".freeze, "README.md".freeze, "Rakefile".freeze, "VERSION".freeze, "diagrams/.keep".freeze, "ext/json/ext/fbuffer/fbuffer.h".freeze, "ext/json/ext/generator/depend".freeze, "ext/json/ext/generator/extconf.rb".freeze, "ext/json/ext/generator/generator.c".freeze, "ext/json/ext/generator/generator.h".freeze, "ext/json/ext/parser/depend".freeze, "ext/json/ext/parser/extconf.rb".freeze, "ext/json/ext/parser/parser.c".freeze, "ext/json/ext/parser/parser.h".freeze, "ext/json/ext/parser/parser.rl".freeze, "ext/json/extconf.rb".freeze, "install.rb".freeze, "java/src/json/ext/ByteListTranscoder.java".freeze, "java/src/json/ext/Generator.java".freeze, "java/src/json/ext/GeneratorMethods.java".freeze, "java/src/json/ext/GeneratorService.java".freeze, "java/src/json/ext/GeneratorState.java".freeze, "java/src/json/ext/OptionsReader.java".freeze, "java/src/json/ext/Parser.java".freeze, "java/src/json/ext/Parser.rl".freeze, "java/src/json/ext/ParserService.java".freeze, "java/src/json/ext/RuntimeInfo.java".freeze, "java/src/json/ext/StringDecoder.java".freeze, "java/src/json/ext/StringEncoder.java".freeze, "java/src/json/ext/Utils.java".freeze, "json-java.gemspec".freeze, "json.gemspec".freeze, "json_pure.gemspec".freeze, "lib/json.rb".freeze, "lib/json/add/bigdecimal.rb".freeze, "lib/json/add/complex.rb".freeze, "lib/json/add/core.rb".freeze, "lib/json/add/date.rb".freeze, "lib/json/add/date_time.rb".freeze, "lib/json/add/exception.rb".freeze, "lib/json/add/ostruct.rb".freeze, "lib/json/add/range.rb".freeze, "lib/json/add/rational.rb".freeze, "lib/json/add/regexp.rb".freeze, "lib/json/add/set.rb".freeze, "lib/json/add/struct.rb".freeze, "lib/json/add/symbol.rb".freeze, "lib/json/add/time.rb".freeze, "lib/json/common.rb".freeze, "lib/json/ext.rb".freeze, "lib/json/ext/.keep".freeze, "lib/json/generic_object.rb".freeze, "lib/json/pure.rb".freeze, "lib/json/pure/generator.rb".freeze, "lib/json/pure/parser.rb".freeze, "lib/json/version.rb".freeze, "references/rfc7159.txt".freeze, "tests/fixtures/fail10.json".freeze, "tests/fixtures/fail11.json".freeze, "tests/fixtures/fail12.json".freeze, "tests/fixtures/fail13.json".freeze, "tests/fixtures/fail14.json".freeze, "tests/fixtures/fail18.json".freeze, "tests/fixtures/fail19.json".freeze, "tests/fixtures/fail2.json".freeze, "tests/fixtures/fail20.json".freeze, "tests/fixtures/fail21.json".freeze, "tests/fixtures/fail22.json".freeze, "tests/fixtures/fail23.json".freeze, "tests/fixtures/fail24.json".freeze, "tests/fixtures/fail25.json".freeze, "tests/fixtures/fail27.json".freeze, "tests/fixtures/fail28.json".freeze, "tests/fixtures/fail3.json".freeze, "tests/fixtures/fail4.json".freeze, "tests/fixtures/fail5.json".freeze, "tests/fixtures/fail6.json".freeze, "tests/fixtures/fail7.json".freeze, "tests/fixtures/fail8.json".freeze, "tests/fixtures/fail9.json".freeze, "tests/fixtures/obsolete_fail1.json".freeze, "tests/fixtures/pass1.json".freeze, "tests/fixtures/pass15.json".freeze, "tests/fixtures/pass16.json".freeze, "tests/fixtures/pass17.json".freeze, "tests/fixtures/pass2.json".freeze, "tests/fixtures/pass26.json".freeze, "tests/fixtures/pass3.json".freeze, "tests/json_addition_test.rb".freeze, "tests/json_common_interface_test.rb".freeze, "tests/json_encoding_test.rb".freeze, "tests/json_ext_parser_test.rb".freeze, "tests/json_fixtures_test.rb".freeze, "tests/json_generator_test.rb".freeze, "tests/json_generic_object_test.rb".freeze, "tests/json_parser_test.rb".freeze, "tests/json_string_matching_test.rb".freeze, "tests/test_helper.rb".freeze, "tools/diff.sh".freeze, "tools/fuzz.rb".freeze, "tools/server.rb".freeze]
16
+ s.homepage = "http://flori.github.com/json".freeze
17
+ s.licenses = ["Ruby".freeze]
18
+ s.rdoc_options = ["--title".freeze, "JSON implemention for ruby".freeze, "--main".freeze, "README.md".freeze]
19
+ s.required_ruby_version = Gem::Requirement.new(">= 1.9".freeze)
20
+ s.rubygems_version = "3.0.3".freeze
21
+ s.summary = "JSON Implementation for Ruby".freeze
22
+ s.test_files = ["./tests/test_helper.rb".freeze]
22
23
 
23
24
  if s.respond_to? :specification_version then
24
25
  s.specification_version = 4
25
26
 
26
27
  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
- s.add_development_dependency(%q<rake>, ["~> 0.9.2"])
28
+ s.add_development_dependency(%q<rake>.freeze, [">= 0"])
29
+ s.add_development_dependency(%q<test-unit>.freeze, ["~> 2.0"])
30
30
  else
31
- s.add_dependency(%q<permutation>, [">= 0"])
32
- s.add_dependency(%q<sdoc>, ["~> 0.3.16"]) if RUBY_VERSION > "1.8.6"
33
- s.add_dependency(%q<rake>, ["~> 0.9.2"])
31
+ s.add_dependency(%q<rake>.freeze, [">= 0"])
32
+ s.add_dependency(%q<test-unit>.freeze, ["~> 2.0"])
34
33
  end
35
34
  else
36
- s.add_dependency(%q<permutation>, [">= 0"])
37
- s.add_dependency(%q<sdoc>, ["~> 0.3.16"]) if RUBY_VERSION > "1.8.6"
38
- s.add_dependency(%q<rake>, ["~> 0.9.2"])
35
+ s.add_dependency(%q<rake>.freeze, [">= 0"])
36
+ s.add_dependency(%q<test-unit>.freeze, ["~> 2.0"])
39
37
  end
40
38
  end
@@ -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,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 Complex
22
23
  end
23
24
 
24
25
  # 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
26
+ def to_json(*args)
27
+ as_json.to_json(*args)
27
28
  end
28
- end
29
+ 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,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
@@ -21,7 +22,7 @@ class Rational
21
22
  end
22
23
 
23
24
  # 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
25
+ def to_json(*args)
26
+ as_json.to_json(*args)
26
27
  end
27
28
  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