rocking_chair 0.4.2 → 0.4.5
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.
- data/Gemfile.lock +19 -14
- data/lib/rocking_chair/helper.rb +24 -4
- metadata +14 -11
data/Gemfile.lock
CHANGED
@@ -1,13 +1,16 @@
|
|
1
1
|
GEM
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
|
-
activemodel (3.0
|
5
|
-
activesupport (= 3.0
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
4
|
+
activemodel (3.1.0)
|
5
|
+
activesupport (= 3.1.0)
|
6
|
+
bcrypt-ruby (~> 3.0.0)
|
7
|
+
builder (~> 3.0.0)
|
8
|
+
i18n (~> 0.6)
|
9
|
+
activesupport (3.1.0)
|
10
|
+
multi_json (~> 1.0)
|
11
|
+
bcrypt-ruby (3.0.0)
|
12
|
+
builder (3.0.0)
|
13
|
+
couch_potato (0.5.7.3)
|
11
14
|
activemodel
|
12
15
|
couchrest (>= 1.0.1)
|
13
16
|
json
|
@@ -21,15 +24,16 @@ GEM
|
|
21
24
|
couchrest (>= 1.0.0)
|
22
25
|
mime-types (>= 1.15)
|
23
26
|
git (1.2.5)
|
24
|
-
i18n (0.
|
27
|
+
i18n (0.6.0)
|
25
28
|
jeweler (1.6.4)
|
26
29
|
bundler (~> 1.0)
|
27
30
|
git (>= 1.2.5)
|
28
31
|
rake
|
29
|
-
json (1.5.
|
32
|
+
json (1.5.4)
|
30
33
|
mattmatt-validatable (1.8.4)
|
31
34
|
mime-types (1.16)
|
32
35
|
mocha (0.9.12)
|
36
|
+
multi_json (1.0.3)
|
33
37
|
rake (0.9.2)
|
34
38
|
rest-client (1.6.1)
|
35
39
|
mime-types (>= 1.16)
|
@@ -38,10 +42,11 @@ GEM
|
|
38
42
|
right_http_connection (1.3.0)
|
39
43
|
shoulda (2.11.3)
|
40
44
|
shoulda-addons (0.2.3)
|
41
|
-
simply_stored (0.
|
45
|
+
simply_stored (0.7.0rc2)
|
46
|
+
activemodel (~> 3.1.0)
|
42
47
|
activesupport
|
43
|
-
activesupport (~> 3)
|
44
|
-
couch_potato (= 0.5.7)
|
48
|
+
activesupport (~> 3.1.0)
|
49
|
+
couch_potato (= 0.5.7.3)
|
45
50
|
couch_potato (>= 0.2.15)
|
46
51
|
couchrest (= 1.0.1)
|
47
52
|
mattmatt-validatable (= 1.8.4)
|
@@ -59,10 +64,10 @@ PLATFORMS
|
|
59
64
|
ruby
|
60
65
|
|
61
66
|
DEPENDENCIES
|
62
|
-
couch_potato (= 0.5.7)
|
67
|
+
couch_potato (= 0.5.7.3)
|
63
68
|
couchrest_extended_document
|
64
69
|
jeweler
|
65
70
|
mocha
|
66
71
|
shoulda
|
67
|
-
simply_stored (= 0.
|
72
|
+
simply_stored (= 0.7.0rc2)
|
68
73
|
uuidtools
|
data/lib/rocking_chair/helper.rb
CHANGED
@@ -2,16 +2,36 @@
|
|
2
2
|
|
3
3
|
module RockingChair
|
4
4
|
module Helper
|
5
|
-
|
5
|
+
|
6
6
|
def self.jsonfy_options(options, *keys)
|
7
7
|
keys.each do |key|
|
8
|
-
options[key] =
|
8
|
+
options[key] = json_content(options[key]) if options[key]
|
9
9
|
end
|
10
10
|
end
|
11
|
-
|
11
|
+
|
12
12
|
def self.access(attr_name, doc)
|
13
13
|
doc.respond_to?(:_document) ? doc._document[attr_name] : doc[attr_name]
|
14
14
|
end
|
15
|
-
|
15
|
+
|
16
|
+
def self.json_content(string)
|
17
|
+
if string && string.size < 2 # just one character --> only hashes and arrays are valid root objects
|
18
|
+
fixed_json_content(string)
|
19
|
+
elsif string == 'null'
|
20
|
+
nil
|
21
|
+
elsif string
|
22
|
+
ActiveSupport::JSON.decode(string)
|
23
|
+
else
|
24
|
+
nil
|
25
|
+
end
|
26
|
+
rescue JSON::ParserError, MultiJson::DecodeError
|
27
|
+
# probably: only hashes and arrays are valid root objects --> try to fix
|
28
|
+
fixed_json_content(string)
|
29
|
+
end
|
30
|
+
|
31
|
+
def self.fixed_json_content(string)
|
32
|
+
# wrap content in array, then parse and return first value
|
33
|
+
ActiveSupport::JSON.decode("[#{string}]")[0]
|
34
|
+
end
|
35
|
+
|
16
36
|
end
|
17
37
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rocking_chair
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 5
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 4
|
9
|
-
-
|
10
|
-
version: 0.4.
|
9
|
+
- 5
|
10
|
+
version: 0.4.5
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Jonathan Weiss
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-08-
|
18
|
+
date: 2011-08-31 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
version_requirements: &id001 !ruby/object:Gem::Requirement
|
@@ -37,12 +37,14 @@ dependencies:
|
|
37
37
|
requirements:
|
38
38
|
- - "="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
hash:
|
40
|
+
hash: 15424097
|
41
41
|
segments:
|
42
42
|
- 0
|
43
|
-
-
|
44
|
-
-
|
45
|
-
|
43
|
+
- 7
|
44
|
+
- 0
|
45
|
+
- rc
|
46
|
+
- 2
|
47
|
+
version: 0.7.0rc2
|
46
48
|
name: simply_stored
|
47
49
|
prerelease: false
|
48
50
|
type: :runtime
|
@@ -53,12 +55,13 @@ dependencies:
|
|
53
55
|
requirements:
|
54
56
|
- - "="
|
55
57
|
- !ruby/object:Gem::Version
|
56
|
-
hash:
|
58
|
+
hash: 125
|
57
59
|
segments:
|
58
60
|
- 0
|
59
61
|
- 5
|
60
62
|
- 7
|
61
|
-
|
63
|
+
- 3
|
64
|
+
version: 0.5.7.3
|
62
65
|
name: couch_potato
|
63
66
|
prerelease: false
|
64
67
|
type: :runtime
|
@@ -175,7 +178,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
175
178
|
requirements: []
|
176
179
|
|
177
180
|
rubyforge_project:
|
178
|
-
rubygems_version: 1.8.
|
181
|
+
rubygems_version: 1.8.10
|
179
182
|
signing_key:
|
180
183
|
specification_version: 3
|
181
184
|
summary: In-memory CouchDB for Couchrest and SimplyStored
|