From ea3cd40554a674989275e8b24f382e3c6409ce5a Mon Sep 17 00:00:00 2001 From: Zachary Scott Date: Fri, 24 Oct 2014 13:10:50 -0700 Subject: Include return value in examples added in #17378 [ci skip] --- activesupport/lib/active_support/core_ext/object/try.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'activesupport/lib/active_support') diff --git a/activesupport/lib/active_support/core_ext/object/try.rb b/activesupport/lib/active_support/core_ext/object/try.rb index 0bc675329d..5b5729eb92 100644 --- a/activesupport/lib/active_support/core_ext/object/try.rb +++ b/activesupport/lib/active_support/core_ext/object/try.rb @@ -21,11 +21,11 @@ class Object # # +try+ will also return +nil+ if the receiver does not respond to the method: # - # @person.try(:non_existing_method) + # @person.try(:non_existing_method) #=> nil # # instead of # - # @person.non_existing_method if @person.respond_to?(:non_existing_method) + # @person.non_existing_method if @person.respond_to?(:non_existing_method) #=> nil # # +try+ returns +nil+ when called on +nil+ regardless of whether it responds # to the method: -- cgit v1.2.3