footing 0.0.8 → 0.0.9
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/lib/extensions/nil_class.rb +18 -0
- metadata +3 -2
@@ -0,0 +1,18 @@
|
|
1
|
+
module Footing
|
2
|
+
module NilClass
|
3
|
+
|
4
|
+
# Similar to ActiveSupport's #try added to NilClass.
|
5
|
+
# Calling [] on nil always returns nil.
|
6
|
+
# It becomes especially helpful when navigating through deeply nested Hashes.
|
7
|
+
#
|
8
|
+
# @example
|
9
|
+
# dict = {}
|
10
|
+
# dict[:foo][:bar][:other] # => nil
|
11
|
+
#
|
12
|
+
# @param [Object] key The key to lookup.
|
13
|
+
def [](key)
|
14
|
+
nil
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: footing
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-09-
|
12
|
+
date: 2012-09-03 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: ! ' Footing is a utillity belt library that employs sane monkey patching.
|
15
15
|
|
@@ -23,6 +23,7 @@ files:
|
|
23
23
|
- lib/extensions/array.rb
|
24
24
|
- lib/extensions/hash.rb
|
25
25
|
- lib/extensions/kernel.rb
|
26
|
+
- lib/extensions/nil_class.rb
|
26
27
|
- lib/extensions/numeric.rb
|
27
28
|
- lib/extensions/object.rb
|
28
29
|
- lib/extensions/postgresql_adapter.rb
|