instance method
try!
Ruby on Rails 4.2.9
Since v4.0.13Signature
try!(*a, &b)
Same as #try, but will raise a NoMethodError exception if the receiver is not nil and does not implement the tried method.
Parameters
-
arest -
bblock
Source
# File activesupport/lib/active_support/core_ext/object/try.rb, line 69
def try!(*a, &b)
if a.empty? && block_given?
if b.arity == 0
instance_eval(&b)
else
yield self
end
else
public_send(*a, &b)
end
end
Defined in activesupport/lib/active_support/core_ext/object/try.rb line 69
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in Object