mpatch 2.8.0 → 2.8.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/VERSION +1 -1
  3. data/lib/mpatch/hash.rb +13 -0
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c83a2235fa0593775a3614b626e8096ffd9bf428
4
- data.tar.gz: 04557bd6c3ce119162e1fdf97673a4979924e828
3
+ metadata.gz: 5d3b57e9a4cc8dab797ca68d8414ffddef06c6a7
4
+ data.tar.gz: eb443c2ee71867129b43a0e1c053fa384cb7b631
5
5
  SHA512:
6
- metadata.gz: 1d16553211e2f477117fbe06777e07cf17bec4c5a13b893339579fddf534a2296503fba2c73a665af5b093b0c517ea001d778b1411fee39a821324364a9545e7
7
- data.tar.gz: 63c7bdb2d8fbfb3ffbda713c2ee97d7e39a210c1fd8b6c0aab04ea5123c9e7d1b202c7490cdd3198c74ea73d352844ad039dbb03662bac6ced6c43e2faafc686
6
+ metadata.gz: 8ec36f94ce8777af0c9c8f470741044004ef36873364c016040553be28b351b0a7d3eb3431cdab565a7a5a604a034ebeaca109874865d343450c828fc1e6bdf3
7
+ data.tar.gz: fa99e29c236c18bb4035f490ef681aaef02b6075d9e92651b07236a8686170655527966c2e857175afebec86acdc9339c8c954500e50e3820b8307f154a2df4b
data/VERSION CHANGED
@@ -1,2 +1,2 @@
1
- 2.8.0
1
+ 2.8.1
2
2
 
data/lib/mpatch/hash.rb CHANGED
@@ -110,6 +110,19 @@ module MPatch
110
110
  return tmp_hash
111
111
  end
112
112
 
113
+ # Fetch a nested hash value
114
+ def value_by_keys(*attrs)
115
+ attr_count = attrs.size
116
+ current_val = self
117
+ for i in 0..(attr_count-1)
118
+ attr_name = attrs[i]
119
+ return current_val[attr_name] if i == (attr_count-1)
120
+ return nil if current_val[attr_name].nil?
121
+ current_val = current_val[attr_name]
122
+ end
123
+ return nil
124
+ end
125
+
113
126
  end
114
127
 
115
128
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mpatch
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.8.0
4
+ version: 2.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Luzsi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-14 00:00:00.000000000 Z
11
+ date: 2014-04-20 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: This is a collection of my Ruby monkey patches for making easer to use
14
14
  the basic classes