Module: Drum::Try
- Included in:
- Object
- Defined in:
- lib/drum/utils/ext.rb
Instance Method Summary collapse
-
#try {|value| ... } ⇒ Object?
A lightweight variant of Rails’ try that only supports blocks (the other variants are already handled more elegantly using &.).
Instance Method Details
#try {|value| ... } ⇒ Object?
A lightweight variant of Rails’ try that only supports blocks (the other variants are already handled more elegantly using &.).
10 11 12 13 14 15 16 |
# File 'lib/drum/utils/ext.rb', line 10 def try if self.nil? nil else yield self end end |