Class: Object
- Inherits:
- BasicObject
- Defined in:
- lib/aromat/try.rb
Overview
Monkey-patch Object Class
Instance Method Summary collapse
-
#try(meth, *args, &block) ⇒ Object
Try: Call a method if possible, do nothing otherwise.
Instance Method Details
#try(meth, *args, &block) ⇒ Object
Try: Call a method if possible, do nothing otherwise.
12 13 14 15 |
# File 'lib/aromat/try.rb', line 12 def try meth, *args, &block return nil unless respond_to? meth send meth.to_sym, *args, &block end |