diff options
author | Jon Leighton <j@jonathanleighton.com> | 2011-08-25 18:51:17 +0100 |
---|---|---|
committer | Jon Leighton <j@jonathanleighton.com> | 2011-08-25 22:30:42 +0100 |
commit | 8ba491acc31bf08cf63a83ea0a3c314c52cd020f (patch) | |
tree | 617a8a8133b700811cca12942f802bb4c0167904 /activesupport/lib/active_support/core_ext/object | |
parent | bad6803570f5f3b09d277b15c9f272bfae7408da (diff) | |
download | rails-8ba491acc31bf08cf63a83ea0a3c314c52cd020f.tar.gz rails-8ba491acc31bf08cf63a83ea0a3c314c52cd020f.tar.bz2 rails-8ba491acc31bf08cf63a83ea0a3c314c52cd020f.zip |
Revert all the stuff to do with disallowing non-public methods for Module#delegate
Diffstat (limited to 'activesupport/lib/active_support/core_ext/object')
-rw-r--r-- | activesupport/lib/active_support/core_ext/object/public_send.rb | 25 |
1 files changed, 0 insertions, 25 deletions
diff --git a/activesupport/lib/active_support/core_ext/object/public_send.rb b/activesupport/lib/active_support/core_ext/object/public_send.rb deleted file mode 100644 index 2e77a22c4b..0000000000 --- a/activesupport/lib/active_support/core_ext/object/public_send.rb +++ /dev/null @@ -1,25 +0,0 @@ -require 'active_support/core_ext/kernel/singleton_class' - -class Object - unless Object.public_method_defined?(:public_send) - # Backports Object#public_send from 1.9 - def public_send(method, *args, &block) - # Don't create a singleton class for the object if it doesn't already have one - # (This also protects us from classes like Fixnum and Symbol, which cannot have a - # singleton class.) - klass = singleton_methods.any? ? self.singleton_class : self.class - - if klass.public_method_defined?(method) - send(method, *args, &block) - else - if klass.private_method_defined?(method) - raise NoMethodError, "private method `#{method}' called for #{inspect}" - elsif klass.protected_method_defined?(method) - raise NoMethodError, "protected method `#{method}' called for #{inspect}" - else - raise NoMethodError, "undefined method `#{method}' for #{inspect}" - end - end - end - end -end |