instance method
try!
Ruby on Rails edge
Since v4.0.13Signature
try!(*args, &block)
Same as #try, but raises a NoMethodError exception if the receiver is not nil and does not implement the tried method.
“‘ruby “a”.try!(:upcase) # => “A” nil.try!(:upcase) # => nil 123.try!(:upcase) # => NoMethodError: undefined method `upcase’ for 123:Integer “‘
Source
# File activesupport/lib/active_support/core_ext/object/try.rb, line 122
Defined in activesupport/lib/active_support/core_ext/object/try.rb line 122
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in Object