jsos 1.2.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +14 -0
- data/jsos.gemspec +1 -1
- data/lib/jsos.rb +10 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 42368bd5dfcd62a8c2ac7ec27b1100111fc793d0
|
4
|
+
data.tar.gz: 2338e2c122d978363754716eba8b80669528bc72
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b17d9d0aafc1c2cfb768513379172be5874ebd8ad7b08217f8d46b0e6ad2723dbef8bd8b8c6f4b9e845e7038124bc1ebb822afafa33a43c2db0880a6236d710e
|
7
|
+
data.tar.gz: 71303c8f44bab7986a0118fa27bc153ee1837b139eccf97db1085a40a550e0d7397ffbcc1915b4a754018cfad35b2a5de025386825799fb93eb51be2034f936d
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,19 @@
|
|
1
1
|
# CHANGELOG
|
2
2
|
|
3
|
+
## v1.2.1 (Feb 08, 2016)
|
4
|
+
* Hashes are converted into JSOS objects when part of an array value
|
5
|
+
|
6
|
+
```ruby
|
7
|
+
json = "{\"foo\":[{\"foo\":\"bar\"}, \"baz\"]}"
|
8
|
+
jsos = JSOS.new(json)
|
9
|
+
|
10
|
+
jsos.foo
|
11
|
+
#=> ["#<JSOS foo=\"bar\">", "baz"]
|
12
|
+
|
13
|
+
jsos.foo.first.foo
|
14
|
+
#=> "bar"
|
15
|
+
```
|
16
|
+
|
3
17
|
## v1.2.0 (Jan 13, 2016)
|
4
18
|
* Add `JSOS#to_a`
|
5
19
|
* Alias `JSOS#to_a` to `JSOS#to_ary`
|
data/jsos.gemspec
CHANGED
data/lib/jsos.rb
CHANGED
@@ -109,7 +109,16 @@ class JSOS < OpenStruct
|
|
109
109
|
# @api private
|
110
110
|
def parse_state_hash state
|
111
111
|
state.inject({}) do |hash, (key, value)|
|
112
|
-
merge_value =
|
112
|
+
merge_value = case value
|
113
|
+
when Hash
|
114
|
+
{ key => JSOS.new(value) }
|
115
|
+
when Array
|
116
|
+
array = value.map{ |v| JSOS.new(v) rescue v }
|
117
|
+
{ key => array }
|
118
|
+
else
|
119
|
+
{ key => value }
|
120
|
+
end
|
121
|
+
|
113
122
|
hash.merge(merge_value)
|
114
123
|
end
|
115
124
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jsos
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Johnson Denen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-02-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|