instance method
try!
Ruby on Rails 7.0.10
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.
"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 104
Defined in activesupport/lib/active_support/core_ext/object/try.rb line 104
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in Object