aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib
diff options
context:
space:
mode:
authorRichard Schneeman <richard.schneeman+no-recruiters@gmail.com>2018-10-05 09:37:38 -0500
committerGitHub <noreply@github.com>2018-10-05 09:37:38 -0500
commit0d4b2e4da6532b07d6321eb158a62ef3924917da (patch)
tree046320afbc4a554d0c04211ec2b8a8a7b93cebd6 /activesupport/lib
parente1c60894bb9ac5586837022027325b3a30ac9eb2 (diff)
parent81d43f6282e2582d70105365ba3aa56ba25d08b7 (diff)
downloadrails-0d4b2e4da6532b07d6321eb158a62ef3924917da.tar.gz
rails-0d4b2e4da6532b07d6321eb158a62ef3924917da.tar.bz2
rails-0d4b2e4da6532b07d6321eb158a62ef3924917da.zip
Merge pull request #34068 from schneems/schneems/micro-optimize-try-nil
23% faster Nil#try
Diffstat (limited to 'activesupport/lib')
-rw-r--r--activesupport/lib/active_support/core_ext/object/try.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/activesupport/lib/active_support/core_ext/object/try.rb b/activesupport/lib/active_support/core_ext/object/try.rb
index aa6896af32..ef8a1f476d 100644
--- a/activesupport/lib/active_support/core_ext/object/try.rb
+++ b/activesupport/lib/active_support/core_ext/object/try.rb
@@ -143,14 +143,14 @@ class NilClass
#
# With +try+
# @person.try(:children).try(:first).try(:name)
- def try(*args)
+ def try(method_name = nil, *args)
nil
end
# Calling +try!+ on +nil+ always returns +nil+.
#
# nil.try!(:name) # => nil
- def try!(*args)
+ def try!(method_name = nil, *args)
nil
end
end