rufus-json 0.2.6 → 0.2.7
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.txt +1 -1
- data/lib/rufus/json.rb +9 -9
- data/rufus-json.gemspec +1 -1
- metadata +4 -3
data/CHANGELOG.txt
CHANGED
data/lib/rufus/json.rb
CHANGED
@@ -26,7 +26,7 @@
|
|
26
26
|
module Rufus
|
27
27
|
module Json
|
28
28
|
|
29
|
-
VERSION = '0.2.
|
29
|
+
VERSION = '0.2.7'
|
30
30
|
|
31
31
|
# The JSON / JSON pure decoder
|
32
32
|
#
|
@@ -108,7 +108,7 @@ module Json
|
|
108
108
|
#
|
109
109
|
# It's OK to pass a symbol as well, :yajl, :json, :active (or :none).
|
110
110
|
#
|
111
|
-
def self.backend=
|
111
|
+
def self.backend=(b)
|
112
112
|
|
113
113
|
if b.is_a?(Symbol)
|
114
114
|
b = { :yajl => YAJL, :json => JSON, :active => ACTIVE, :none => NONE }[b]
|
@@ -119,14 +119,14 @@ module Json
|
|
119
119
|
|
120
120
|
# Encodes the given object to a JSON string.
|
121
121
|
#
|
122
|
-
def self.encode
|
122
|
+
def self.encode(o, opts={})
|
123
123
|
|
124
124
|
@backend[0].call(o, opts)
|
125
125
|
end
|
126
126
|
|
127
127
|
# Pretty encoding
|
128
128
|
#
|
129
|
-
def self.pretty_encode
|
129
|
+
def self.pretty_encode(o)
|
130
130
|
|
131
131
|
case @backend
|
132
132
|
when JSON
|
@@ -140,14 +140,14 @@ module Json
|
|
140
140
|
|
141
141
|
# An alias for .encode
|
142
142
|
#
|
143
|
-
def self.dump
|
143
|
+
def self.dump(o, opts={})
|
144
144
|
|
145
145
|
encode(o, opts)
|
146
146
|
end
|
147
147
|
|
148
148
|
# Decodes the given JSON string.
|
149
149
|
#
|
150
|
-
def self.decode
|
150
|
+
def self.decode(s)
|
151
151
|
|
152
152
|
@backend[1].call(s)
|
153
153
|
|
@@ -157,7 +157,7 @@ module Json
|
|
157
157
|
|
158
158
|
# An alias for .decode
|
159
159
|
#
|
160
|
-
def self.load
|
160
|
+
def self.load(s)
|
161
161
|
|
162
162
|
decode(s)
|
163
163
|
end
|
@@ -166,7 +166,7 @@ module Json
|
|
166
166
|
#
|
167
167
|
# Don't laugh, yajl-ruby makes that faster than a Marshal copy.
|
168
168
|
#
|
169
|
-
def self.dup
|
169
|
+
def self.dup(o)
|
170
170
|
|
171
171
|
(@backend == NONE) ? Marshal.load(Marshal.dump(o)) : decode(encode(o))
|
172
172
|
end
|
@@ -175,7 +175,7 @@ module Json
|
|
175
175
|
|
176
176
|
# Let's ActiveSupport do the E number notation.
|
177
177
|
#
|
178
|
-
def self.decode_e
|
178
|
+
def self.decode_e(s)
|
179
179
|
|
180
180
|
s.match(E_REGEX) ? eval(s) : false
|
181
181
|
end
|
data/rufus-json.gemspec
CHANGED
@@ -9,7 +9,7 @@ Gem::Specification.new do |s|
|
|
9
9
|
s.name = 'rufus-json'
|
10
10
|
s.version = Rufus::Json::VERSION
|
11
11
|
s.platform = Gem::Platform::RUBY
|
12
|
-
s.authors = [ 'John Mettraux' ]
|
12
|
+
s.authors = [ 'John Mettraux', 'Torsten Schoenebaum' ]
|
13
13
|
s.email = [ 'jmettraux@gmail.com' ]
|
14
14
|
s.homepage = 'http://github.com/jmettraux/rufus-json'
|
15
15
|
s.rubyforge_project = 'rufus'
|
metadata
CHANGED
@@ -1,16 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rufus-json
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 7
|
10
|
+
version: 0.2.7
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- John Mettraux
|
14
|
+
- Torsten Schoenebaum
|
14
15
|
autorequire:
|
15
16
|
bindir: bin
|
16
17
|
cert_chain: []
|