From af41d5540b0bab8c8cee8cbc7cbfb8fab0676518 Mon Sep 17 00:00:00 2001 From: Sebastian Martinez Date: Mon, 18 Apr 2011 09:33:00 -0300 Subject: Fixed docs for NilClass#try --- activesupport/lib/active_support/core_ext/object/try.rb | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'activesupport/lib/active_support/core_ext/object/try.rb') diff --git a/activesupport/lib/active_support/core_ext/object/try.rb b/activesupport/lib/active_support/core_ext/object/try.rb index 0977ac51e8..c2a3abbc7c 100644 --- a/activesupport/lib/active_support/core_ext/object/try.rb +++ b/activesupport/lib/active_support/core_ext/object/try.rb @@ -9,12 +9,12 @@ class Object # # ==== Examples # - # Without try + # Without +try+ # @person && @person.name # or # @person ? @person.name : nil # - # With try + # With +try+ # @person.try(:name) # # +try+ also accepts arguments and/or a block, for the method it is trying @@ -35,17 +35,17 @@ class Object end class NilClass - # Instances of NilClass return always +nil+ - # It becomes specially helpful when navigating through associations that may return nil + # Instances of +NilClass+ return always +nil+. + # It becomes specially helpful when navigating through associations that may return +nil+. # # === Examples # - # nil.try(:name) # => nil + # nill.try(:name) # => nil # - # Without try - # @person && @person.children.first && @person.children.first.name + # Without +try+ + # @person && !@person.children.blank? && @person.children.first.name # - # With try + # With +try+ # @person.try(:children).try(:first).try(:name) def try(*args) nil -- cgit v1.2.3