json 1.8.3-java → 1.8.5-java

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of json might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3b84f10e4844be3576a540bca0579e5fa2bb21e3
4
- data.tar.gz: cdf565ce241f4401646ee8309f5c0debf3c19f95
3
+ metadata.gz: 220ac0461bacfc9f8c43a48c6a167cd8d3dfea7e
4
+ data.tar.gz: 221775a3c15d8972d4e724a0c541f85a0ffd5102
5
5
  SHA512:
6
- metadata.gz: 5440ee9016069daef51e6820dfe4b759fd96f61911b0ecad27752e050142e161f9682d2463953b61153536aaf7006d2d09fd1db89c8c033a27a726cda12eb07e
7
- data.tar.gz: 6b010a26f908b22e93c4914a625292d71d39ed968c6b8ee9652018ec28988248cdcacd9d527b136359c6ea9aa6c2c5cb50abacf4c664882e0f9f6337fc4d2fb6
6
+ metadata.gz: d2932d989adf5cc35e70b662cff2af267fe2fbb6ad5bce8929ba8c763cf35d15eb48d2d509322c1f1fa8ca76b96f9a00091c09a77c5d5e4ce2dfb66433ac5cd8
7
+ data.tar.gz: 558bbf908ecd5d08e22247659ebedb39e74b99077aef75533afa92e17f86c669eff97db9a5c9308fa1e7dc0ed3892ddae5c7b410b7b35c80e84615b9b9fdc606
Binary file
Binary file
@@ -363,7 +363,11 @@ module JSON
363
363
  result << state.space_before
364
364
  result << ':'
365
365
  result << state.space
366
- result << value.to_json(state)
366
+ if value.respond_to?(:to_json)
367
+ result << value.to_json(state)
368
+ else
369
+ result << %{"#{String(value)}"}
370
+ end
367
371
  first = false
368
372
  }
369
373
  depth = state.depth -= 1
@@ -398,7 +402,11 @@ module JSON
398
402
  each { |value|
399
403
  result << delim unless first
400
404
  result << state.indent * depth if indent
401
- result << value.to_json(state)
405
+ if value.respond_to?(:to_json)
406
+ result << value.to_json(state)
407
+ else
408
+ result << %{"#{String(value)}"}
409
+ end
402
410
  first = false
403
411
  }
404
412
  depth = state.depth -= 1
@@ -1,6 +1,6 @@
1
1
  module JSON
2
2
  # JSON version
3
- VERSION = '1.8.3'
3
+ VERSION = '1.8.5'
4
4
  VERSION_ARRAY = VERSION.split(/\./).map { |x| x.to_i } # :nodoc:
5
5
  VERSION_MAJOR = VERSION_ARRAY[0] # :nodoc:
6
6
  VERSION_MINOR = VERSION_ARRAY[1] # :nodoc:
@@ -7,20 +7,6 @@ require 'stringio'
7
7
  require 'tempfile'
8
8
  require 'ostruct'
9
9
 
10
- unless Array.method_defined?(:permutation)
11
- begin
12
- require 'enumerator'
13
- require 'permutation'
14
- class Array
15
- def permutation
16
- Permutation.for(self).to_enum.map { |x| x.project }
17
- end
18
- end
19
- rescue LoadError
20
- warn "Skipping permutation tests."
21
- end
22
- end
23
-
24
10
  class TestJSON < Test::Unit::TestCase
25
11
  include JSON
26
12
 
@@ -146,26 +132,6 @@ class TestJSON < Test::Unit::TestCase
146
132
  assert_raise(JSON::ParserError) { JSON.parse('[ 1, ]', :quirks_mode => true) }
147
133
  end
148
134
 
149
- if Array.method_defined?(:permutation)
150
- def test_parse_more_complex_arrays
151
- a = [ nil, false, true, "foßbar", [ "n€st€d", true ], { "nested" => true, "n€ßt€ð2" => {} }]
152
- a.permutation.each do |perm|
153
- json = pretty_generate(perm)
154
- assert_equal perm, parse(json)
155
- end
156
- end
157
-
158
- def test_parse_complex_objects
159
- a = [ nil, false, true, "foßbar", [ "n€st€d", true ], { "nested" => true, "n€ßt€ð2" => {} }]
160
- a.permutation.each do |perm|
161
- s = "a"
162
- orig_obj = perm.inject({}) { |h, x| h[s.dup] = x; s = s.succ; h }
163
- json = pretty_generate(orig_obj)
164
- assert_equal orig_obj, parse(json)
165
- end
166
- end
167
- end
168
-
169
135
  def test_parse_arrays
170
136
  assert_equal([1,2,3], parse('[1,2,3]'))
171
137
  assert_equal([1.2,2,3], parse('[1.2,2,3]'))
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
  # encoding: utf-8
3
+ # frozen_string_literal: false
3
4
 
4
5
  require 'test/unit'
5
6
  require File.join(File.dirname(__FILE__), 'setup_variant')
@@ -334,4 +335,14 @@ EOT
334
335
  assert_equal true, JSON.generate(["\xea"])
335
336
  end
336
337
  end
338
+
339
+ def test_string_subclass
340
+ s = Class.new(String) do
341
+ def to_s; self; end
342
+ undef to_json
343
+ end
344
+ assert_nothing_raised(SystemStackError) do
345
+ assert_equal '["foo"]', JSON.generate([s.new('foo')])
346
+ end
347
+ end
337
348
  end
metadata CHANGED
@@ -1,15 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: json
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.3
4
+ version: 1.8.5
5
5
  platform: java
6
6
  authors:
7
7
  - Daniel Luz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-01 00:00:00.000000000 Z
12
- dependencies: []
11
+ date: 2017-01-12 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - ">="
17
+ - !ruby/object:Gem::Version
18
+ version: '0'
19
+ name: rake
20
+ prerelease: false
21
+ type: :development
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ requirement: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - "~>"
31
+ - !ruby/object:Gem::Version
32
+ version: '2.0'
33
+ name: test-unit
34
+ prerelease: false
35
+ type: :development
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '2.0'
13
41
  description: A JSON implementation as a JRuby extension.
14
42
  email: dev+ruby@mernen.com
15
43
  executables: []
@@ -89,17 +117,17 @@ require_paths:
89
117
  - lib
90
118
  required_ruby_version: !ruby/object:Gem::Requirement
91
119
  requirements:
92
- - - '>='
120
+ - - ">="
93
121
  - !ruby/object:Gem::Version
94
122
  version: '0'
95
123
  required_rubygems_version: !ruby/object:Gem::Requirement
96
124
  requirements:
97
- - - '>='
125
+ - - ">="
98
126
  - !ruby/object:Gem::Version
99
127
  version: '0'
100
128
  requirements: []
101
129
  rubyforge_project: json-jruby
102
- rubygems_version: 2.4.5
130
+ rubygems_version: 2.6.8
103
131
  signing_key:
104
132
  specification_version: 4
105
133
  summary: JSON implementation for JRuby