multi_json 1.8.0 → 1.8.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e00d526cbb34886c88f45e632e8db48145cbc669
4
- data.tar.gz: c00f7ad76fdb6f0dd5fcd07751a916106c3a9d1c
3
+ metadata.gz: 3c7bf44cc16efece231078942a86b6a5f4403205
4
+ data.tar.gz: 72033c9d66380bbb86f54cf97a9aa2a1bfcb3a9a
5
5
  SHA512:
6
- metadata.gz: 5d940eb443ad93097a97cf55816fb469fc74a840629b7e9bd32551a93ee307d2ca742f60f75bd6776d176224782c2a1ec69ee56d85de12fef68bc2cff51a8b3c
7
- data.tar.gz: 11c12f6352b79f87d2150183473b9a5829eeadd619217e8a6b1aed5389a44ec1295104eca8f49e09c65c8e168aa8cc8b93fd87050fa4e340e78208cf3b2be0ee
6
+ metadata.gz: d7f57462a5cab82e55419698f43ab35d57cb0e2af12dd7b671acfb21515f62c21bdb5d69c0bb9785562a1efc15f39af19b044ab8108e8824b614012e054e9038
7
+ data.tar.gz: d51223b32e9ba6f53b7260126b0d5a13b793be281ac4e376feda73335f7b87fe4dd5c9deff58b7abfde592e38ef1f63d1d139f1b56ca018fb86bf4419dbfd2a5
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ 1.8.0
2
+ -----
3
+ * [Raise MultiJson::LoadError on blank input](https://github.com/intridea/multi_json/commit/c44f9c928bb25fe672246ad394b3e5b991be32e6)
4
+
5
+ 1.7.9
6
+ -----
7
+ * [Explicitly require json gem code even when constant is defined](https://github.com/intridea/multi_json/commit/36f7906c66477eb4b55b7afeaa3684b6db69eff2)
8
+
1
9
  1.7.8
2
10
  -----
3
11
  * [Reorder JrJackson before json_gem](https://github.com/intridea/multi_json/commit/315b6e460b6e4dcdb6c82e04e4be8ee975d395da)
data/Gemfile CHANGED
@@ -13,7 +13,7 @@ end
13
13
 
14
14
  platforms :jruby do
15
15
  gem 'gson', '>= 0.6', :require => nil
16
- gem 'jrjackson', '~> 0.1.1', :require => nil
16
+ gem 'jrjackson', '~> 0.2.0', :require => nil
17
17
  end
18
18
 
19
19
  group :development do
@@ -48,6 +48,8 @@ module MultiJson
48
48
 
49
49
  def blank?(input)
50
50
  input.nil? || /\A\s*\z/ === input
51
+ rescue ArgumentError # invalid byte sequence in UTF-8
52
+ false
51
53
  end
52
54
 
53
55
  end
@@ -12,6 +12,8 @@ module MultiJson
12
12
  string = string.read if string.respond_to?(:read)
13
13
  result = ::MultiJson::OkJson.decode("[#{string}]").first
14
14
  options[:symbolize_keys] ? symbolize_keys(result) : result
15
+ rescue ArgumentError # invalid byte sequence in UTF-8
16
+ raise ParseError
15
17
  end
16
18
 
17
19
  def dump(object, options={})
@@ -2,7 +2,7 @@ module MultiJson
2
2
  class Version
3
3
  MAJOR = 1 unless defined? MultiJson::Version::MAJOR
4
4
  MINOR = 8 unless defined? MultiJson::Version::MINOR
5
- PATCH = 0 unless defined? MultiJson::Version::PATCH
5
+ PATCH = 1 unless defined? MultiJson::Version::PATCH
6
6
  PRE = nil unless defined? MultiJson::Version::PRE
7
7
 
8
8
  class << self
@@ -113,7 +113,7 @@ shared_examples_for 'an adapter' do |adapter|
113
113
  end
114
114
 
115
115
  it 'allows to dump JSON with UTF-8 characters' do
116
- expect(MultiJson.dump({'color' => 'żółć'})).to eq('{"color":"żółć"}')
116
+ expect(MultiJson.dump('color' => 'żółć')).to eq('{"color":"żółć"}')
117
117
  end
118
118
  end
119
119
 
@@ -162,15 +162,11 @@ shared_examples_for 'an adapter' do |adapter|
162
162
  end
163
163
 
164
164
  it 'properly loads valid JSON' do
165
- expect(MultiJson.load('{"abc":"def"}')).to eq({'abc' => 'def'})
165
+ expect(MultiJson.load('{"abc":"def"}')).to eq('abc' => 'def')
166
166
  end
167
167
 
168
- it 'raises MultiJson::LoadError on invalid JSON' do
169
- expect{MultiJson.load('{"abc"}')}.to raise_error(MultiJson::LoadError)
170
- end
171
-
172
- it 'raises MultiJson::LoadError on blank input' do
173
- [nil, ' ', "\t\t\t", "\n"].each do |input|
168
+ it 'raises MultiJson::LoadError on blank input or invalid input' do
169
+ [nil, '{"abc"}', ' ', "\t\t\t", "\n", "\x82\xAC\xEF"].each do |input|
174
170
  expect{MultiJson.load(input)}.to raise_error(MultiJson::LoadError)
175
171
  end
176
172
  end
@@ -196,12 +192,12 @@ shared_examples_for 'an adapter' do |adapter|
196
192
  it 'stringifys symbol keys when encoding' do
197
193
  dumped_json = MultiJson.dump(:a => 1, :b => {:c => 2})
198
194
  loaded_json = MultiJson.load(dumped_json)
199
- expect(loaded_json).to eq({'a' => 1, 'b' => {'c' => 2}})
195
+ expect(loaded_json).to eq('a' => 1, 'b' => {'c' => 2})
200
196
  end
201
197
 
202
198
  it 'properly loads valid JSON in StringIOs' do
203
199
  json = StringIO.new('{"abc":"def"}')
204
- expect(MultiJson.load(json)).to eq({'abc' => 'def'})
200
+ expect(MultiJson.load(json)).to eq('abc' => 'def')
205
201
  end
206
202
 
207
203
  it 'allows for symbolization of keys' do
@@ -228,7 +224,7 @@ shared_examples_for 'an adapter' do |adapter|
228
224
  end
229
225
 
230
226
  it 'allows to load JSON with UTF-8 characters' do
231
- expect(MultiJson.load('{"color":"żółć"}')).to eq({'color' => 'żółć'})
227
+ expect(MultiJson.load('{"color":"żółć"}')).to eq('color' => 'żółć')
232
228
  end
233
229
  end
234
230
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: multi_json
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.0
4
+ version: 1.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Bleigh
@@ -33,7 +33,7 @@ cert_chain:
33
33
  7BTxdlSpJZDcAK29Ni3NRCRu6Air4wfDln0Ilzeuut6cJ4/j2/RlvsccVSRaEfOa
34
34
  wM7GTK5SEdU3qelyBdc4+RRs6uU=
35
35
  -----END CERTIFICATE-----
36
- date: 2013-09-08 00:00:00.000000000 Z
36
+ date: 2013-10-04 00:00:00.000000000 Z
37
37
  dependencies:
38
38
  - !ruby/object:Gem::Dependency
39
39
  name: bundler
@@ -120,7 +120,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
120
120
  version: 1.3.5
121
121
  requirements: []
122
122
  rubyforge_project:
123
- rubygems_version: 2.0.7
123
+ rubygems_version: 2.1.0
124
124
  signing_key:
125
125
  specification_version: 4
126
126
  summary: A common interface to multiple JSON libraries.
metadata.gz.sig CHANGED
Binary file