json 2.1.0-java → 2.2.0-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
- SHA1:
3
- metadata.gz: 634b7c9d77f51f54770f912bce42e4a6765ad87f
4
- data.tar.gz: 67189aeb4ed037c326096522f03d5455d875c5e0
2
+ SHA256:
3
+ metadata.gz: 5cbe28120a7a65d91699b5ad5e8f0c3b1c2c0895cc1bfd1d27de93513da6276c
4
+ data.tar.gz: a79ed2632e93ef7dc2df67f197d56d4be671c61e94ebe59c298cc5d6bde668a3
5
5
  SHA512:
6
- metadata.gz: 7f4402403159951b48a71ae16f990e5a273f89bd249d27d8fc1b965c2017de88480941e3d3f73bb068e5f4e7a91f05dcd46f077f3149c26acada386752e7d796
7
- data.tar.gz: '082bde17c11b76f51ae1fd60df8dd72bdee08c31aae7495d436f1a12d0c2f5b29c028ac2e151921ae8cbe0a027f135a21dd703fea39243dfd5cdfb2667ba2fbd'
6
+ metadata.gz: 711bab89dfc319519f4f5818e87de1d1f12a4e4542b193e5dfdff50a0db12c31fe453a4353666257689b8d3ba2a3456bc818e65065f97e8ca2574add40b7b300
7
+ data.tar.gz: 64b77395e18b73007922ea755f58048dc68262eaf040c12c944ed89fd422db468ed8ccce3c9904a65c6b58fd4848b5462e920cac9039140dfa1cf28db54decfe
@@ -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)
@@ -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
+
Binary file
Binary file
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: false
2
2
  module JSON
3
3
  # JSON version
4
- VERSION = '2.1.0'
4
+ VERSION = '2.2.0'
5
5
  VERSION_ARRAY = VERSION.split(/\./).map { |x| x.to_i } # :nodoc:
6
6
  VERSION_MAJOR = VERSION_ARRAY[0] # :nodoc:
7
7
  VERSION_MINOR = VERSION_ARRAY[1] # :nodoc:
@@ -5,6 +5,7 @@ require 'json/add/complex'
5
5
  require 'json/add/rational'
6
6
  require 'json/add/bigdecimal'
7
7
  require 'json/add/ostruct'
8
+ require 'json/add/set'
8
9
  require 'date'
9
10
 
10
11
  class JSONAdditionTest < Test::Unit::TestCase
@@ -190,4 +191,13 @@ class JSONAdditionTest < Test::Unit::TestCase
190
191
  o.foo = { 'bar' => true }
191
192
  assert_equal o, parse(JSON(o), :create_additions => true)
192
193
  end
194
+
195
+ def test_set
196
+ s = Set.new([:a, :b, :c, :a])
197
+ assert_equal s, JSON.parse(JSON(s), :create_additions => true)
198
+ ss = SortedSet.new([:d, :b, :a, :c])
199
+ ss_again = JSON.parse(JSON(ss), :create_additions => true)
200
+ assert_kind_of ss.class, ss_again
201
+ assert_equal ss, ss_again
202
+ end
193
203
  end
@@ -4,6 +4,7 @@ require 'test_helper'
4
4
  require 'stringio'
5
5
  require 'tempfile'
6
6
  require 'ostruct'
7
+ require 'bigdecimal'
7
8
 
8
9
  class JSONParserTest < Test::Unit::TestCase
9
10
  include JSON
@@ -15,7 +15,3 @@ begin
15
15
  require 'byebug'
16
16
  rescue LoadError
17
17
  end
18
- if ENV['START_SIMPLECOV'].to_i == 1
19
- require 'simplecov'
20
- SimpleCov.start
21
- end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: json
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.2.0
5
5
  platform: java
6
6
  authors:
7
7
  - Daniel Luz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-18 00:00:00.000000000 Z
11
+ date: 2019-02-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -55,6 +55,7 @@ files:
55
55
  - lib/json/add/range.rb
56
56
  - lib/json/add/rational.rb
57
57
  - lib/json/add/regexp.rb
58
+ - lib/json/add/set.rb
58
59
  - lib/json/add/struct.rb
59
60
  - lib/json/add/symbol.rb
60
61
  - lib/json/add/time.rb
@@ -128,7 +129,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
128
129
  version: '0'
129
130
  requirements: []
130
131
  rubyforge_project: json-jruby
131
- rubygems_version: 2.6.8
132
+ rubygems_version: 2.7.6
132
133
  signing_key:
133
134
  specification_version: 4
134
135
  summary: JSON implementation for JRuby