kim 0.0.2 → 0.0.3

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.
Files changed (5) hide show
  1. data/README +5 -1
  2. data/README.md +5 -1
  3. data/lib/kim/hash.rb +4 -0
  4. data/lib/kim/version.rb +1 -1
  5. metadata +4 -4
data/README CHANGED
@@ -6,6 +6,10 @@ This is just a compilation of all some frequent includes I do on my ruby code
6
6
  Hash
7
7
  ----
8
8
 
9
- ### Hash: deep_merge
9
+ ### deep_merge
10
10
 
11
11
  When merging Hashes it will take care of merging nested hashes
12
+
13
+ ### deep_has_key?
14
+
15
+ Provide multiple keys and it will tell you if they are contained in the current hash, taking nesting into account
data/README.md CHANGED
@@ -6,6 +6,10 @@ This is just a compilation of all some frequent includes I do on my ruby code
6
6
  Hash
7
7
  ----
8
8
 
9
- ### Hash: deep_merge
9
+ ### deep_merge
10
10
 
11
11
  When merging Hashes it will take care of merging nested hashes
12
+
13
+ ### deep_has_key?
14
+
15
+ Provide multiple keys and it will tell you if they are contained in the current hash, taking nesting into account
data/lib/kim/hash.rb CHANGED
@@ -16,6 +16,10 @@ module Kim
16
16
  def deep_merge! other
17
17
  deep_merge other, true
18
18
  end
19
+
20
+ def deep_has_key? *keys
21
+ has_key?(key = keys.shift) && ( keys.count < 1 || self[key].deep_has_key?(*keys))
22
+ end
19
23
  end
20
24
  end
21
25
 
data/lib/kim/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Kim
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kim
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 2
10
- version: 0.0.2
9
+ - 3
10
+ version: 0.0.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Giancarlo Palavicini
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-08-18 00:00:00 Z
18
+ date: 2011-08-31 00:00:00 Z
19
19
  dependencies: []
20
20
 
21
21
  description: Handy additions to various ruby classes