hash_dot 2.2.0 → 2.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/hash.rb +16 -2
- data/lib/hash_dot/version.rb +1 -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: 025bbbf6717d54caf3ac01e47c898c073fd92807
|
4
|
+
data.tar.gz: 56fe882509329f3c75b7ac26cca082a608a151ad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1d132f533f12e56e2eae538007eff03c5c2839d16445040de3b2eda9d678903fc25958506b90f44556582a705676259b165330dcc34202b01702da3f165276ce
|
7
|
+
data.tar.gz: 7c9ca35e1a9cb15fb3b99b12f2b137cba4a42c1c20c5cbb79a8a950d5595f0bd52146dd9a09ca989a5e3b351cb3cbcffc8b0eb7076ce4b921c1551519929e098
|
data/lib/hash.rb
CHANGED
@@ -33,14 +33,28 @@ class Hash
|
|
33
33
|
return true if key?(prop)
|
34
34
|
super(method, include_all)
|
35
35
|
end
|
36
|
-
|
36
|
+
|
37
37
|
private
|
38
38
|
|
39
|
+
def dotify_obj(obj, use_default: false)
|
40
|
+
case obj
|
41
|
+
when Array
|
42
|
+
obj.each do |el|
|
43
|
+
dotify_obj(el)
|
44
|
+
end
|
45
|
+
when Hash
|
46
|
+
dotify_hash(obj, use_default: use_default)
|
47
|
+
# else no-op
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
39
51
|
def dotify_hash(hash, use_default: false)
|
40
52
|
hash.use_dot_syntax = true
|
41
53
|
hash.hash_dot_use_default = use_default
|
42
54
|
|
43
|
-
hash.
|
55
|
+
hash.each_value do |val|
|
56
|
+
dotify_obj(val)
|
57
|
+
end
|
44
58
|
end
|
45
59
|
|
46
60
|
def to_dot?
|
data/lib/hash_dot/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hash_dot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Steel
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-01-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|