Method: Object#try
- Defined in:
- lib/ruby/jruby_hack.rb
#try(*args, &block) ⇒ Object
Sends the arguments to ‘self` or yields `self` (when `self` is non-`nil`). This is overridden by NilClass#try, which always returns `nil`.
657 658 659 660 661 662 663 |
# File 'lib/ruby/jruby_hack.rb', line 657 def try(*args, &block) if args.empty? yield self else __send__(*args, &block) end end |