diff options
author | Vijay Dev <vijaydev.cse@gmail.com> | 2012-06-14 22:52:38 +0530 |
---|---|---|
committer | Vijay Dev <vijaydev.cse@gmail.com> | 2012-06-14 22:52:38 +0530 |
commit | c1474ff2e78da7a3443c3eee470a1e9aa5b560dd (patch) | |
tree | d02393ca969e8ab612ab7e764f5504c34bd6da89 /activesupport/lib/active_support/core_ext | |
parent | f5e7cb84cd377feb1b60c5356ce02123e9c94380 (diff) | |
parent | 5795efa9d8c330853c9ce4507abc3d5b8baa65e1 (diff) | |
download | rails-c1474ff2e78da7a3443c3eee470a1e9aa5b560dd.tar.gz rails-c1474ff2e78da7a3443c3eee470a1e9aa5b560dd.tar.bz2 rails-c1474ff2e78da7a3443c3eee470a1e9aa5b560dd.zip |
Merge branch 'master' of github.com:lifo/docrails
Diffstat (limited to 'activesupport/lib/active_support/core_ext')
-rw-r--r-- | activesupport/lib/active_support/core_ext/object/try.rb | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/activesupport/lib/active_support/core_ext/object/try.rb b/activesupport/lib/active_support/core_ext/object/try.rb index 30c835f5cd..16a799ec03 100644 --- a/activesupport/lib/active_support/core_ext/object/try.rb +++ b/activesupport/lib/active_support/core_ext/object/try.rb @@ -11,8 +11,6 @@ class Object # subclasses of +BasicObject+. For example, using try with +SimpleDelegator+ will # delegate +try+ to target instead of calling it on delegator itself. # - # ==== Examples - # # Without +try+ # @person && @person.name # or @@ -27,7 +25,7 @@ class Object # # Without a method argument try will yield to the block unless the receiver is nil. # @person.try { |p| "#{p.first_name} #{p.last_name}" } - #-- + # # +try+ behaves like +Object#public_send+, unless called on +NilClass+. def try(*a, &b) if a.empty? && block_given? @@ -42,8 +40,6 @@ class NilClass # Calling +try+ on +nil+ always returns +nil+. # It becomes specially helpful when navigating through associations that may return +nil+. # - # === Examples - # # nil.try(:name) # => nil # # Without +try+ |