Class: Object
- Inherits:
- BasicObject
- Defined in:
- lib/core_ext/object.rb
Instance Method Summary collapse
-
#try_call(*args) ⇒ Object
Many times an option can either be a callable object (Proc/Lambda) or not (symbol/string/integer).
Instance Method Details
#try_call(*args) ⇒ Object
Many times an option can either be a callable object (Proc/Lambda) or not (symbol/string/integer). This will call with the included arguments, if it is callable, or return the object if not.
5 6 7 8 9 10 11 |
# File 'lib/core_ext/object.rb', line 5 def try_call(*args) if respond_to? :call call(*args) else self end end |