zeke-monkey_patches 0.1.7 → 0.1.8
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/VERSION.yml +1 -1
- data/lib/monkey_patches.rb +11 -0
- metadata +2 -2
data/VERSION.yml
CHANGED
data/lib/monkey_patches.rb
CHANGED
@@ -198,4 +198,15 @@ class Object
|
|
198
198
|
end
|
199
199
|
end
|
200
200
|
|
201
|
+
# @person ? @person.name : nil
|
202
|
+
# vs
|
203
|
+
# @person.try(:name)
|
204
|
+
# Snagged from http://ozmm.org/posts/try.html; later incorporated into Rails 2.3
|
205
|
+
unless method_defined? "try"
|
206
|
+
def try(method)
|
207
|
+
send method if respond_to? method
|
208
|
+
end
|
209
|
+
end
|
210
|
+
|
211
|
+
|
201
212
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zeke-monkey_patches
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Zeke Sikelianos
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-04-
|
12
|
+
date: 2009-04-08 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|