From 8c6de675e49d78244c5936f6e5c31e46f7c21377 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Sat, 11 Sep 2010 20:50:35 -0700 Subject: Remove dummy method definition in favor of RDoc hints: http://rdoc.rubyforge.org/RDoc/Parser/Ruby.html --- activesupport/lib/active_support/core_ext/object/try.rb | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'activesupport/lib/active_support/core_ext') diff --git a/activesupport/lib/active_support/core_ext/object/try.rb b/activesupport/lib/active_support/core_ext/object/try.rb index a1c63a0e54..48e9d04787 100644 --- a/activesupport/lib/active_support/core_ext/object/try.rb +++ b/activesupport/lib/active_support/core_ext/object/try.rb @@ -1,4 +1,7 @@ class Object + ## + # :method: try + # # Invokes the method identified by the symbol +method+, passing it any arguments # and/or the block specified, just like the regular Ruby Object#send does. # @@ -19,13 +22,8 @@ class Object # Person.try(:find, 1) # @people.try(:collect) {|p| p.name} #-- - # This method definition below is for rdoc purposes only. The alias_method call - # below overrides it as an optimization since +try+ behaves like +Object#send+, - # unless called on +NilClass+. - def try(method, *args, &block) - send(method, *args, &block) - end - remove_method :try + # +try+ behaves like +Object#send+, unless called on +NilClass+. + alias_method :try, :__send__ end -- cgit v1.2.3