json 1.8.3 → 2.4.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 (83) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +2 -0
  3. data/.travis.yml +9 -12
  4. data/{CHANGES → CHANGES.md} +219 -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} +201 -134
  9. data/Rakefile +35 -113
  10. data/VERSION +1 -1
  11. data/ext/json/ext/fbuffer/fbuffer.h +0 -3
  12. data/ext/json/ext/generator/generator.c +255 -101
  13. data/ext/json/ext/generator/generator.h +12 -4
  14. data/ext/json/ext/parser/extconf.rb +28 -0
  15. data/ext/json/ext/parser/parser.c +410 -462
  16. data/ext/json/ext/parser/parser.h +5 -5
  17. data/ext/json/ext/parser/parser.rl +166 -181
  18. data/ext/json/extconf.rb +1 -1
  19. data/java/src/json/ext/ByteListTranscoder.java +1 -2
  20. data/java/src/json/ext/Generator.java +39 -36
  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 +33 -56
  24. data/java/src/json/ext/OptionsReader.java +2 -3
  25. data/java/src/json/ext/Parser.java +146 -417
  26. data/java/src/json/ext/Parser.rl +62 -126
  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 +13 -2
  31. data/java/src/json/ext/Utils.java +1 -2
  32. data/json-java.gemspec +22 -7
  33. data/json.gemspec +0 -0
  34. data/json_pure.gemspec +22 -29
  35. data/lib/json/add/bigdecimal.rb +3 -2
  36. data/lib/json/add/complex.rb +4 -4
  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 -3
  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 +350 -152
  50. data/lib/json/ext.rb +0 -6
  51. data/lib/json/generic_object.rb +5 -4
  52. data/lib/json/pure/generator.rb +83 -126
  53. data/lib/json/pure/parser.rb +62 -84
  54. data/lib/json/pure.rb +2 -8
  55. data/lib/json/version.rb +2 -1
  56. data/lib/json.rb +550 -29
  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} +28 -25
  60. data/tests/json_common_interface_test.rb +169 -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} +13 -8
  64. data/tests/{test_json_generate.rb → json_generator_test.rb} +134 -39
  65. data/tests/{test_json_generic_object.rb → json_generic_object_test.rb} +15 -8
  66. data/tests/json_parser_test.rb +497 -0
  67. data/tests/json_string_matching_test.rb +38 -0
  68. data/tests/test_helper.rb +17 -0
  69. data/tools/diff.sh +18 -0
  70. data/tools/fuzz.rb +1 -9
  71. metadata +47 -53
  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/setup_variant.rb +0 -11
  80. data/tests/test_json.rb +0 -553
  81. data/tests/test_json_encoding.rb +0 -65
  82. data/tests/test_json_string_matching.rb +0 -39
  83. 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,10 @@ public class Parser extends RubyObject {
51
50
  private int maxNesting;
52
51
  private boolean allowNaN;
53
52
  private boolean symbolizeNames;
54
- private boolean quirksMode;
53
+ private boolean freeze;
55
54
  private RubyClass objectClass;
56
55
  private RubyClass arrayClass;
56
+ private RubyClass decimalClass;
57
57
  private RubyHash match_string;
58
58
 
59
59
  private static final int DEFAULT_MAX_NESTING = 100;
@@ -122,10 +122,6 @@ public class Parser extends RubyObject {
122
122
  * <dd>If set to <code>true</code>, returns symbols for the names (keys) in
123
123
  * a JSON object. Otherwise strings are returned, which is also the default.
124
124
  *
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
125
  * <dt><code>:create_additions</code>
130
126
  * <dd>If set to <code>false</code>, the Parser doesn't create additions
131
127
  * even if a matching class and <code>create_id</code> was found. This option
@@ -137,9 +133,10 @@ public class Parser extends RubyObject {
137
133
  * <dt><code>:array_class</code>
138
134
  * <dd>Defaults to Array.
139
135
  *
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.
136
+ * <dt><code>:decimal_class</code>
137
+ * <dd>Specifies which class to use instead of the default (Float) when
138
+ * parsing decimal numbers. This class must accept a single string argument
139
+ * in its constructor.
143
140
  * </dl>
144
141
  */
145
142
  @JRubyMethod(name = "new", required = 1, optional = 1, meta = true)
@@ -162,15 +159,22 @@ public class Parser extends RubyObject {
162
159
  this.maxNesting = opts.getInt("max_nesting", DEFAULT_MAX_NESTING);
163
160
  this.allowNaN = opts.getBool("allow_nan", false);
164
161
  this.symbolizeNames = opts.getBool("symbolize_names", false);
165
- this.quirksMode = opts.getBool("quirks_mode", false);
162
+ this.freeze = opts.getBool("freeze", false);
166
163
  this.createId = opts.getString("create_id", getCreateId(context));
167
164
  this.createAdditions = opts.getBool("create_additions", false);
168
165
  this.objectClass = opts.getClass("object_class", runtime.getHash());
169
166
  this.arrayClass = opts.getClass("array_class", runtime.getArray());
167
+ this.decimalClass = opts.getClass("decimal_class", null);
170
168
  this.match_string = opts.getHash("match_string");
171
169
 
170
+ if(symbolizeNames && createAdditions) {
171
+ throw runtime.newArgumentError(
172
+ "options :symbolize_names and :create_additions cannot be " +
173
+ " used in conjunction"
174
+ );
175
+ }
172
176
  this.vSource = args[0].convertToString();
173
- if (!quirksMode) this.vSource = convertEncoding(context, vSource);
177
+ this.vSource = convertEncoding(context, vSource);
174
178
 
175
179
  return this;
176
180
  }
@@ -181,33 +185,16 @@ public class Parser extends RubyObject {
181
185
  * Returns the source string if no conversion is needed.
182
186
  */
183
187
  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});
188
+ RubyEncoding encoding = (RubyEncoding)source.encoding(context);
189
+ if (encoding == info.ascii8bit.get()) {
190
+ if (source.isFrozen()) {
191
+ source = (RubyString) source.dup();
192
+ }
193
+ source.force_encoding(context, info.utf8.get());
194
+ } else {
195
+ source = (RubyString) source.encode(context, info.utf8.get());
196
+ }
197
+ return source;
211
198
  }
212
199
 
213
200
  /**
@@ -260,17 +247,6 @@ public class Parser extends RubyObject {
260
247
  return checkAndGetSource().dup();
261
248
  }
262
249
 
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
250
  public RubyString checkAndGetSource() {
275
251
  if (vSource != null) {
276
252
  return vSource;
@@ -394,7 +370,7 @@ public class Parser extends RubyObject {
394
370
  }
395
371
  }
396
372
  action parse_number {
397
- if (pe > fpc + 9 - (parser.quirksMode ? 1 : 0) &&
373
+ if (pe > fpc + 8 &&
398
374
  absSubSequence(fpc, fpc + 9).equals(JSON_MINUS_INFINITY)) {
399
375
 
400
376
  if (parser.allowNaN) {
@@ -478,6 +454,9 @@ public class Parser extends RubyObject {
478
454
  %% write exec;
479
455
 
480
456
  if (cs >= JSON_value_first_final && result != null) {
457
+ if (parser.freeze) {
458
+ result.setFrozen(true);
459
+ }
481
460
  res.update(result, p);
482
461
  } else {
483
462
  res.update(null, p);
@@ -521,13 +500,13 @@ public class Parser extends RubyObject {
521
500
 
522
501
  return p;
523
502
  }
524
-
503
+
525
504
  RubyInteger createInteger(int p, int new_p) {
526
505
  Ruby runtime = getRuntime();
527
506
  ByteList num = absSubSequence(p, new_p);
528
507
  return bytesToInum(runtime, num);
529
508
  }
530
-
509
+
531
510
  RubyInteger bytesToInum(Ruby runtime, ByteList num) {
532
511
  return runtime.is1_9() ?
533
512
  ConvertBytes.byteListToInum19(runtime, num, 10, true) :
@@ -557,7 +536,9 @@ public class Parser extends RubyObject {
557
536
  res.update(null, p);
558
537
  return;
559
538
  }
560
- RubyFloat number = createFloat(p, new_p);
539
+ IRubyObject number = parser.decimalClass == null ?
540
+ createFloat(p, new_p) : createCustomDecimal(p, new_p);
541
+
561
542
  res.update(number, new_p + 1);
562
543
  return;
563
544
  }
@@ -572,16 +553,23 @@ public class Parser extends RubyObject {
572
553
  if (cs < JSON_float_first_final) {
573
554
  return -1;
574
555
  }
575
-
556
+
576
557
  return p;
577
558
  }
578
-
559
+
579
560
  RubyFloat createFloat(int p, int new_p) {
580
561
  Ruby runtime = getRuntime();
581
562
  ByteList num = absSubSequence(p, new_p);
582
563
  return RubyFloat.newFloat(runtime, dc.parse(num, true, runtime.is1_9()));
583
564
  }
584
565
 
566
+ IRubyObject createCustomDecimal(int p, int new_p) {
567
+ Ruby runtime = getRuntime();
568
+ ByteList num = absSubSequence(p, new_p);
569
+ IRubyObject numString = runtime.newString(num.toString());
570
+ return parser.decimalClass.callMethod(context, "new", numString);
571
+ }
572
+
585
573
  %%{
586
574
  machine JSON_string;
587
575
  include JSON_common;
@@ -624,11 +612,11 @@ public class Parser extends RubyObject {
624
612
  %% write exec;
625
613
 
626
614
  if (parser.createAdditions) {
627
- RubyHash match_string = parser.match_string;
628
- if (match_string != null) {
615
+ RubyHash matchString = parser.match_string;
616
+ if (matchString != null) {
629
617
  final IRubyObject[] memoArray = { result, null };
630
618
  try {
631
- match_string.visitAll(new RubyHash.Visitor() {
619
+ matchString.visitAll(new RubyHash.Visitor() {
632
620
  @Override
633
621
  public void visit(IRubyObject pattern, IRubyObject klass) {
634
622
  if (pattern.callMethod(context, "===", memoArray[0]).isTrue()) {
@@ -648,11 +636,18 @@ public class Parser extends RubyObject {
648
636
  }
649
637
  }
650
638
 
651
- if (cs >= JSON_string_first_final && result != null) {
652
- if (info.encodingsSupported() && result instanceof RubyString) {
653
- ((RubyString)result).force_encoding(context, info.utf8.get());
639
+ if (cs >= JSON_string_first_final && result != null) {
640
+ if (result instanceof RubyString) {
641
+ RubyString string = (RubyString)result;
642
+ string.force_encoding(context, info.utf8.get());
643
+ if (parser.freeze) {
644
+ string.setFrozen(true);
645
+ string = getRuntime().freezeAndDedupString(string);
646
+ }
647
+ res.update(string, p + 1);
648
+ } else {
649
+ res.update(result, p + 1);
654
650
  }
655
- res.update(result, p + 1);
656
651
  } else {
657
652
  res.update(null, p + 1);
658
653
  }
@@ -766,7 +761,7 @@ public class Parser extends RubyObject {
766
761
  fhold;
767
762
  fbreak;
768
763
  }
769
-
764
+
770
765
  pair = ignore* begin_name >parse_name ignore* name_separator
771
766
  ignore* begin_value >parse_value;
772
767
  next_pair = ignore* value_separator pair;
@@ -836,60 +831,6 @@ public class Parser extends RubyObject {
836
831
 
837
832
  write data;
838
833
 
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
834
  action parse_value {
894
835
  parseValue(res, fpc, pe);
895
836
  if (res.result == null) {
@@ -906,7 +847,7 @@ public class Parser extends RubyObject {
906
847
  ignore*;
907
848
  }%%
908
849
 
909
- public IRubyObject parseQuirksMode() {
850
+ public IRubyObject parseImplemetation() {
910
851
  int cs = EVIL;
911
852
  int p, pe;
912
853
  IRubyObject result = null;
@@ -917,7 +858,7 @@ public class Parser extends RubyObject {
917
858
  pe = p + byteList.length();
918
859
  %% write exec;
919
860
 
920
- if (cs >= JSON_quirks_mode_first_final && p == pe) {
861
+ if (cs >= JSON_first_final && p == pe) {
921
862
  return result;
922
863
  } else {
923
864
  throw unexpectedToken(p, pe);
@@ -925,12 +866,7 @@ public class Parser extends RubyObject {
925
866
  }
926
867
 
927
868
  public IRubyObject parse() {
928
- if (parser.quirksMode) {
929
- return parseQuirksMode();
930
- } else {
931
- return parseStrict();
932
- }
933
-
869
+ return parseImplemetation();
934
870
  }
935
871
 
936
872
  /**
@@ -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;
@@ -10,7 +15,7 @@ import org.jruby.util.ByteList;
10
15
  * and throws a GeneratorError if any problem is found.
11
16
  */
12
17
  final class StringEncoder extends ByteListTranscoder {
13
- private final boolean asciiOnly;
18
+ private final boolean asciiOnly, escapeSlash;
14
19
 
15
20
  // Escaped characters will reuse this array, to avoid new allocations
16
21
  // or appending them byte-by-byte
@@ -32,9 +37,10 @@ final class StringEncoder extends ByteListTranscoder {
32
37
  new byte[] {'0', '1', '2', '3', '4', '5', '6', '7',
33
38
  '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
34
39
 
35
- StringEncoder(ThreadContext context, boolean asciiOnly) {
40
+ StringEncoder(ThreadContext context, boolean asciiOnly, boolean escapeSlash) {
36
41
  super(context);
37
42
  this.asciiOnly = asciiOnly;
43
+ this.escapeSlash = escapeSlash;
38
44
  }
39
45
 
40
46
  void encode(ByteList src, ByteList out) {
@@ -68,6 +74,11 @@ final class StringEncoder extends ByteListTranscoder {
68
74
  case '\b':
69
75
  escapeChar('b');
70
76
  break;
77
+ case '/':
78
+ if(escapeSlash) {
79
+ escapeChar((char)c);
80
+ break;
81
+ }
71
82
  default:
72
83
  if (c >= 0x20 && c <= 0x7f ||
73
84
  (c >= 0x80 && !asciiOnly)) {
@@ -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
@@ -1,19 +1,34 @@
1
- #!/usr/bin/env jruby
2
- require "rubygems"
1
+ # -*- encoding: utf-8 -*-
3
2
 
4
3
  spec = Gem::Specification.new do |s|
5
4
  s.name = "json"
6
5
  s.version = File.read("VERSION").chomp
7
- s.summary = "JSON implementation for JRuby"
6
+
7
+ s.summary = "JSON Implementation for Ruby"
8
8
  s.description = "A JSON implementation as a JRuby extension."
9
+ s.licenses = ["Ruby"]
9
10
  s.author = "Daniel Luz"
10
11
  s.email = "dev+ruby@mernen.com"
11
- s.homepage = "http://json-jruby.rubyforge.org/"
12
+
12
13
  s.platform = 'java'
13
- s.rubyforge_project = "json-jruby"
14
- s.licenses = ["Ruby"]
15
14
 
16
- s.files = Dir["{docs,lib,tests}/**/*"]
15
+ s.files = Dir["{docs,lib,tests}/**/*", "LICENSE"]
16
+
17
+ s.homepage = "http://flori.github.com/json"
18
+ s.metadata = {
19
+ 'bug_tracker_uri' => 'https://github.com/flori/json/issues',
20
+ 'changelog_uri' => 'https://github.com/flori/json/blob/master/CHANGES.md',
21
+ 'documentation_uri' => 'http://flori.github.io/json/doc/index.html',
22
+ 'homepage_uri' => 'http://flori.github.io/json/',
23
+ 'source_code_uri' => 'https://github.com/flori/json',
24
+ 'wiki_uri' => 'https://github.com/flori/json/wiki'
25
+ }
26
+
27
+ s.required_ruby_version = Gem::Requirement.new(">= 2.0")
28
+ s.test_files = ["tests/test_helper.rb"]
29
+
30
+ s.add_development_dependency("rake", [">= 0"])
31
+ s.add_development_dependency("test-unit", [">= 2.0", "< 4.0"])
17
32
  end
18
33
 
19
34
  if $0 == __FILE__
data/json.gemspec CHANGED
Binary file
data/json_pure.gemspec CHANGED
@@ -1,40 +1,33 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # stub: json_pure 1.8.3 ruby lib
3
2
 
4
3
  Gem::Specification.new do |s|
5
- s.name = "json_pure"
6
- s.version = "1.8.3"
4
+ s.name = "json_pure".freeze
5
+ s.version = File.read("VERSION").chomp
7
6
 
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"]
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
8
+ s.require_paths = ["lib".freeze]
9
+ s.authors = ["Florian Frank".freeze]
10
+ s.description = "This is a JSON implementation in pure Ruby.".freeze
11
+ s.email = "flori@ping.de".freeze
12
+ s.extra_rdoc_files = ["README.md".freeze]
13
+ 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]
14
+ s.homepage = "http://flori.github.com/json".freeze
15
+ s.licenses = ["Ruby".freeze]
16
+ s.rdoc_options = ["--title".freeze, "JSON implemention for ruby".freeze, "--main".freeze, "README.md".freeze]
17
+ s.required_ruby_version = Gem::Requirement.new(">= 2.0".freeze)
18
+ s.rubygems_version = "3.1.2".freeze
19
+ s.summary = "JSON Implementation for Ruby".freeze
20
+ s.test_files = ["./tests/test_helper.rb".freeze]
22
21
 
23
22
  if s.respond_to? :specification_version then
24
23
  s.specification_version = 4
24
+ end
25
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
- s.add_development_dependency(%q<rake>, ["~> 0.9.2"])
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"])
34
- end
26
+ if s.respond_to? :add_runtime_dependency then
27
+ s.add_development_dependency(%q<rake>.freeze, [">= 0"])
28
+ s.add_development_dependency(%q<test-unit>.freeze, [">= 2.0", "< 4.0"])
35
29
  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"])
30
+ s.add_dependency(%q<rake>.freeze, [">= 0"])
31
+ s.add_dependency(%q<test-unit>.freeze, [">= 2.0", "< 4.0"])
39
32
  end
40
33
  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,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