We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f8beca0 commit 3c6cbadCopy full SHA for 3c6cbad
activesupport/lib/active_support/core_ext/object/try.rb
@@ -28,8 +28,6 @@ class Object
28
def try(*a, &b)
29
if a.empty? && block_given?
30
yield self
31
- elsif !a.empty? && !respond_to?(a.first)
32
- nil
33
else
34
__send__(*a, &b)
35
end
activesupport/test/core_ext/object_and_class_ext_test.rb
@@ -99,7 +99,7 @@ def setup
99
def test_nonexisting_method
100
method = :undefined_method
101
assert !@string.respond_to?(method)
102
- assert_nil @string.try(method)
+ assert_raise(NoMethodError) { @string.try(method) }
103
104
105
def test_nonexisting_method_with_arguments
0 commit comments