multi_json 1.3.7 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.rspec +1 -0
- data/lib/multi_json/adapters/json_common.rb +1 -1
- data/lib/multi_json/adapters/ok_json.rb +1 -1
- data/lib/multi_json/version.rb +1 -1
- data/multi_json.gemspec +1 -0
- data/spec/adapter_shared_example.rb +10 -0
- data/spec/multi_json_spec.rb +2 -0
- metadata +88 -75
- data/lib/multi_json/version.rbc +0 -180
data/.rspec
CHANGED
@@ -4,7 +4,7 @@ module MultiJson
|
|
4
4
|
|
5
5
|
def load(string, options={})
|
6
6
|
string = string.read if string.respond_to?(:read)
|
7
|
-
::JSON.parse(string, :symbolize_names => options[:symbolize_keys])
|
7
|
+
::JSON.parse(string, :symbolize_names => options[:symbolize_keys], :quirks_mode => true)
|
8
8
|
end
|
9
9
|
|
10
10
|
def dump(object, options={})
|
@@ -7,7 +7,7 @@ module MultiJson
|
|
7
7
|
|
8
8
|
def self.load(string, options={}) #:nodoc:
|
9
9
|
string = string.read if string.respond_to?(:read)
|
10
|
-
result = ::MultiJson::OkJson.decode(string)
|
10
|
+
result = ::MultiJson::OkJson.decode("[#{string}]").first
|
11
11
|
options[:symbolize_keys] ? symbolize_keys(result) : result
|
12
12
|
end
|
13
13
|
|
data/lib/multi_json/version.rb
CHANGED
data/multi_json.gemspec
CHANGED
@@ -12,6 +12,7 @@ Gem::Specification.new do |gem|
|
|
12
12
|
gem.extra_rdoc_files = ['LICENSE.md', 'README.md']
|
13
13
|
gem.files = Dir['LICENSE.md', 'README.md', 'Rakefile', 'multi_json.gemspec', 'Gemfile', '.document', '.rspec', '.travis.yml' ,'spec/**/*', 'lib/**/*']
|
14
14
|
gem.homepage = 'http://github.com/intridea/multi_json'
|
15
|
+
gem.licenses = ['MIT']
|
15
16
|
gem.name = 'multi_json'
|
16
17
|
gem.rdoc_options = ["--charset=UTF-8"]
|
17
18
|
gem.require_paths = ['lib']
|
@@ -61,6 +61,11 @@ shared_examples_for "an adapter" do |adapter|
|
|
61
61
|
it 'dumps custom objects which implement as_json' do
|
62
62
|
expect(MultiJson.dump(TimeWithZone.new)).to eq "\"2005-02-01T15:15:10Z\""
|
63
63
|
end
|
64
|
+
|
65
|
+
it 'allow to dump JSON values' do
|
66
|
+
expect(MultiJson.dump(42)).to eq '42'
|
67
|
+
end
|
68
|
+
|
64
69
|
end
|
65
70
|
|
66
71
|
describe '.load' do
|
@@ -109,5 +114,10 @@ shared_examples_for "an adapter" do |adapter|
|
|
109
114
|
expect(MultiJson.load(example, :symbolize_keys => true)).to eq expected
|
110
115
|
end
|
111
116
|
end
|
117
|
+
|
118
|
+
it 'allow to load JSON values' do
|
119
|
+
expect(MultiJson.load('42')).to eq 42
|
120
|
+
end
|
121
|
+
|
112
122
|
end
|
113
123
|
end
|
data/spec/multi_json_spec.rb
CHANGED
@@ -41,6 +41,8 @@ describe 'MultiJson' do
|
|
41
41
|
end
|
42
42
|
|
43
43
|
it 'defaults to the best available gem' do
|
44
|
+
# Clear cache variable already set by previous tests
|
45
|
+
MultiJson.send(:remove_instance_variable, :@adapter)
|
44
46
|
unless jruby?
|
45
47
|
require 'oj'
|
46
48
|
expect(MultiJson.adapter.name).to eq 'MultiJson::Adapters::Oj'
|
metadata
CHANGED
@@ -1,94 +1,98 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: multi_json
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 7
|
5
5
|
prerelease:
|
6
|
+
segments:
|
7
|
+
- 1
|
8
|
+
- 4
|
9
|
+
- 0
|
10
|
+
version: 1.4.0
|
6
11
|
platform: ruby
|
7
|
-
authors:
|
12
|
+
authors:
|
8
13
|
- Michael Bleigh
|
9
14
|
- Josh Kalderimis
|
10
15
|
- Erik Michaels-Ober
|
11
16
|
autorequire:
|
12
17
|
bindir: bin
|
13
18
|
cert_chain: []
|
14
|
-
|
15
|
-
|
16
|
-
|
19
|
+
|
20
|
+
date: 2012-11-30 00:00:00 -08:00
|
21
|
+
default_executable:
|
22
|
+
dependencies:
|
23
|
+
- !ruby/object:Gem::Dependency
|
17
24
|
name: rake
|
18
|
-
requirement: !ruby/object:Gem::Requirement
|
19
|
-
none: false
|
20
|
-
requirements:
|
21
|
-
- - ~>
|
22
|
-
- !ruby/object:Gem::Version
|
23
|
-
version: '0.9'
|
24
|
-
type: :development
|
25
25
|
prerelease: false
|
26
|
-
|
27
|
-
none: false
|
28
|
-
requirements:
|
29
|
-
- - ~>
|
30
|
-
- !ruby/object:Gem::Version
|
31
|
-
version: '0.9'
|
32
|
-
- !ruby/object:Gem::Dependency
|
33
|
-
name: rdoc
|
34
|
-
requirement: !ruby/object:Gem::Requirement
|
26
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
35
27
|
none: false
|
36
|
-
requirements:
|
28
|
+
requirements:
|
37
29
|
- - ~>
|
38
|
-
- !ruby/object:Gem::Version
|
39
|
-
|
30
|
+
- !ruby/object:Gem::Version
|
31
|
+
hash: 25
|
32
|
+
segments:
|
33
|
+
- 0
|
34
|
+
- 9
|
35
|
+
version: "0.9"
|
40
36
|
type: :development
|
37
|
+
version_requirements: *id001
|
38
|
+
- !ruby/object:Gem::Dependency
|
39
|
+
name: rdoc
|
41
40
|
prerelease: false
|
42
|
-
|
43
|
-
none: false
|
44
|
-
requirements:
|
45
|
-
- - ~>
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '3.9'
|
48
|
-
- !ruby/object:Gem::Dependency
|
49
|
-
name: rspec
|
50
|
-
requirement: !ruby/object:Gem::Requirement
|
41
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
51
42
|
none: false
|
52
|
-
requirements:
|
43
|
+
requirements:
|
53
44
|
- - ~>
|
54
|
-
- !ruby/object:Gem::Version
|
55
|
-
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
hash: 21
|
47
|
+
segments:
|
48
|
+
- 3
|
49
|
+
- 9
|
50
|
+
version: "3.9"
|
56
51
|
type: :development
|
52
|
+
version_requirements: *id002
|
53
|
+
- !ruby/object:Gem::Dependency
|
54
|
+
name: rspec
|
57
55
|
prerelease: false
|
58
|
-
|
59
|
-
none: false
|
60
|
-
requirements:
|
61
|
-
- - ~>
|
62
|
-
- !ruby/object:Gem::Version
|
63
|
-
version: '2.6'
|
64
|
-
- !ruby/object:Gem::Dependency
|
65
|
-
name: simplecov
|
66
|
-
requirement: !ruby/object:Gem::Requirement
|
56
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
67
57
|
none: false
|
68
|
-
requirements:
|
58
|
+
requirements:
|
69
59
|
- - ~>
|
70
|
-
- !ruby/object:Gem::Version
|
71
|
-
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
hash: 15
|
62
|
+
segments:
|
63
|
+
- 2
|
64
|
+
- 6
|
65
|
+
version: "2.6"
|
72
66
|
type: :development
|
67
|
+
version_requirements: *id003
|
68
|
+
- !ruby/object:Gem::Dependency
|
69
|
+
name: simplecov
|
73
70
|
prerelease: false
|
74
|
-
|
71
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
75
72
|
none: false
|
76
|
-
requirements:
|
73
|
+
requirements:
|
77
74
|
- - ~>
|
78
|
-
- !ruby/object:Gem::Version
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
hash: 3
|
77
|
+
segments:
|
78
|
+
- 0
|
79
|
+
- 4
|
80
|
+
version: "0.4"
|
81
|
+
type: :development
|
82
|
+
version_requirements: *id004
|
83
|
+
description: A gem to provide easy switching between different JSON backends, including Oj, Yajl, the JSON gem (with C-extensions), the pure-Ruby JSON gem, and OkJson.
|
84
|
+
email:
|
83
85
|
- michael@intridea.com
|
84
86
|
- josh.kalderimis@gmail.com
|
85
87
|
- sferik@gmail.com
|
86
88
|
executables: []
|
89
|
+
|
87
90
|
extensions: []
|
88
|
-
|
91
|
+
|
92
|
+
extra_rdoc_files:
|
89
93
|
- LICENSE.md
|
90
94
|
- README.md
|
91
|
-
files:
|
95
|
+
files:
|
92
96
|
- LICENSE.md
|
93
97
|
- README.md
|
94
98
|
- Rakefile
|
@@ -109,35 +113,44 @@ files:
|
|
109
113
|
- lib/multi_json/adapters/yajl.rb
|
110
114
|
- lib/multi_json/vendor/okjson.rb
|
111
115
|
- lib/multi_json/version.rb
|
112
|
-
- lib/multi_json/version.rbc
|
113
116
|
- lib/multi_json.rb
|
117
|
+
has_rdoc: true
|
114
118
|
homepage: http://github.com/intridea/multi_json
|
115
|
-
licenses:
|
119
|
+
licenses:
|
120
|
+
- MIT
|
116
121
|
post_install_message:
|
117
|
-
rdoc_options:
|
122
|
+
rdoc_options:
|
118
123
|
- --charset=UTF-8
|
119
|
-
require_paths:
|
124
|
+
require_paths:
|
120
125
|
- lib
|
121
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
126
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
122
127
|
none: false
|
123
|
-
requirements:
|
124
|
-
- -
|
125
|
-
- !ruby/object:Gem::Version
|
126
|
-
|
127
|
-
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
hash: 3
|
132
|
+
segments:
|
133
|
+
- 0
|
134
|
+
version: "0"
|
135
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
128
136
|
none: false
|
129
|
-
requirements:
|
130
|
-
- -
|
131
|
-
- !ruby/object:Gem::Version
|
137
|
+
requirements:
|
138
|
+
- - ">="
|
139
|
+
- !ruby/object:Gem::Version
|
140
|
+
hash: 23
|
141
|
+
segments:
|
142
|
+
- 1
|
143
|
+
- 3
|
144
|
+
- 6
|
132
145
|
version: 1.3.6
|
133
146
|
requirements: []
|
147
|
+
|
134
148
|
rubyforge_project:
|
135
|
-
rubygems_version: 1.
|
149
|
+
rubygems_version: 1.6.2
|
136
150
|
signing_key:
|
137
151
|
specification_version: 3
|
138
152
|
summary: A gem to provide swappable JSON backends.
|
139
|
-
test_files:
|
153
|
+
test_files:
|
140
154
|
- spec/adapter_shared_example.rb
|
141
155
|
- spec/helper.rb
|
142
156
|
- spec/multi_json_spec.rb
|
143
|
-
has_rdoc:
|
data/lib/multi_json/version.rbc
DELETED
@@ -1,180 +0,0 @@
|
|
1
|
-
!RBIX
|
2
|
-
9595534255132031488
|
3
|
-
x
|
4
|
-
M
|
5
|
-
1
|
6
|
-
n
|
7
|
-
n
|
8
|
-
x
|
9
|
-
10
|
10
|
-
__script__
|
11
|
-
i
|
12
|
-
28
|
13
|
-
99
|
14
|
-
7
|
15
|
-
0
|
16
|
-
65
|
17
|
-
49
|
18
|
-
1
|
19
|
-
2
|
20
|
-
13
|
21
|
-
99
|
22
|
-
12
|
23
|
-
7
|
24
|
-
2
|
25
|
-
12
|
26
|
-
7
|
27
|
-
3
|
28
|
-
12
|
29
|
-
65
|
30
|
-
12
|
31
|
-
49
|
32
|
-
4
|
33
|
-
4
|
34
|
-
15
|
35
|
-
49
|
36
|
-
2
|
37
|
-
0
|
38
|
-
15
|
39
|
-
2
|
40
|
-
11
|
41
|
-
I
|
42
|
-
6
|
43
|
-
I
|
44
|
-
0
|
45
|
-
I
|
46
|
-
0
|
47
|
-
I
|
48
|
-
0
|
49
|
-
n
|
50
|
-
p
|
51
|
-
5
|
52
|
-
x
|
53
|
-
9
|
54
|
-
MultiJson
|
55
|
-
x
|
56
|
-
11
|
57
|
-
open_module
|
58
|
-
x
|
59
|
-
15
|
60
|
-
__module_init__
|
61
|
-
M
|
62
|
-
1
|
63
|
-
n
|
64
|
-
n
|
65
|
-
x
|
66
|
-
9
|
67
|
-
MultiJson
|
68
|
-
i
|
69
|
-
48
|
70
|
-
5
|
71
|
-
66
|
72
|
-
26
|
73
|
-
93
|
74
|
-
0
|
75
|
-
15
|
76
|
-
29
|
77
|
-
21
|
78
|
-
0
|
79
|
-
45
|
80
|
-
0
|
81
|
-
1
|
82
|
-
7
|
83
|
-
2
|
84
|
-
3
|
85
|
-
98
|
86
|
-
3
|
87
|
-
3
|
88
|
-
30
|
89
|
-
8
|
90
|
-
27
|
91
|
-
25
|
92
|
-
92
|
93
|
-
0
|
94
|
-
27
|
95
|
-
8
|
96
|
-
32
|
97
|
-
15
|
98
|
-
7
|
99
|
-
4
|
100
|
-
8
|
101
|
-
33
|
102
|
-
1
|
103
|
-
9
|
104
|
-
38
|
105
|
-
1
|
106
|
-
8
|
107
|
-
47
|
108
|
-
65
|
109
|
-
7
|
110
|
-
2
|
111
|
-
7
|
112
|
-
5
|
113
|
-
64
|
114
|
-
49
|
115
|
-
6
|
116
|
-
2
|
117
|
-
11
|
118
|
-
I
|
119
|
-
4
|
120
|
-
I
|
121
|
-
0
|
122
|
-
I
|
123
|
-
0
|
124
|
-
I
|
125
|
-
0
|
126
|
-
n
|
127
|
-
p
|
128
|
-
7
|
129
|
-
x
|
130
|
-
9
|
131
|
-
MultiJson
|
132
|
-
n
|
133
|
-
x
|
134
|
-
7
|
135
|
-
VERSION
|
136
|
-
x
|
137
|
-
22
|
138
|
-
vm_const_defined_under
|
139
|
-
s
|
140
|
-
8
|
141
|
-
constant
|
142
|
-
s
|
143
|
-
5
|
144
|
-
1.3.6
|
145
|
-
x
|
146
|
-
9
|
147
|
-
const_set
|
148
|
-
p
|
149
|
-
5
|
150
|
-
I
|
151
|
-
2
|
152
|
-
I
|
153
|
-
2
|
154
|
-
I
|
155
|
-
2f
|
156
|
-
I
|
157
|
-
0
|
158
|
-
I
|
159
|
-
30
|
160
|
-
x
|
161
|
-
69
|
162
|
-
/Users/sferik/Projects/Ruby/gems/multi_json/lib/multi_json/version.rb
|
163
|
-
p
|
164
|
-
0
|
165
|
-
x
|
166
|
-
13
|
167
|
-
attach_method
|
168
|
-
p
|
169
|
-
3
|
170
|
-
I
|
171
|
-
0
|
172
|
-
I
|
173
|
-
1
|
174
|
-
I
|
175
|
-
1c
|
176
|
-
x
|
177
|
-
69
|
178
|
-
/Users/sferik/Projects/Ruby/gems/multi_json/lib/multi_json/version.rb
|
179
|
-
p
|
180
|
-
0
|