diff options
author | Sebastian Martinez <sebastian@wyeworks.com> | 2011-04-18 09:33:00 -0300 |
---|---|---|
committer | Sebastian Martinez <sebastian@wyeworks.com> | 2011-04-18 09:33:00 -0300 |
commit | af41d5540b0bab8c8cee8cbc7cbfb8fab0676518 (patch) | |
tree | 26ce661be1eb85e57cc3a4c5514820b80d5749fb /activesupport/lib/active_support | |
parent | 9556e9c9236eee70c7c69d83893024ccec7587a5 (diff) | |
download | rails-af41d5540b0bab8c8cee8cbc7cbfb8fab0676518.tar.gz rails-af41d5540b0bab8c8cee8cbc7cbfb8fab0676518.tar.bz2 rails-af41d5540b0bab8c8cee8cbc7cbfb8fab0676518.zip |
Fixed docs for NilClass#try
Diffstat (limited to 'activesupport/lib/active_support')
-rw-r--r-- | activesupport/lib/active_support/core_ext/object/try.rb | 16 |
1 files changed, 8 insertions, 8 deletions
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 |