1
0
Fork 0
mirror of https://github.com/capistrano/capistrano synced 2023-03-27 23:21:18 -04:00
This commit is contained in:
Roy Liu 2012-12-10 05:22:45 -05:00
parent d5802d9077
commit 3100b9118b
2 changed files with 9 additions and 2 deletions

View file

@ -43,7 +43,14 @@ module Capistrano
# Must mix last, because it hooks into previously defined methods
include Callbacks
((self.instance_methods & Kernel.methods) - Namespaces::Namespace.instance_methods).each do |name|
(self.instance_methods & Kernel.methods).select do |name|
# Select the instance methods owned by the Configuration class.
self.instance_method(name).owner.to_s.start_with?("Capistrano::Configuration")
end.select do |name|
# Of those, select methods that are being shadowed by the Kernel module in the Namespace class.
Namespaces::Namespace.method_defined?(name) && Namespaces::Namespace.instance_method(name).owner == Kernel
end.each do |name|
# Undefine the shadowed methods, since we want Namespace objects to defer handling to the Configuration object.
Namespaces::Namespace.send(:undef_method, name)
end
end

View file

@ -213,7 +213,7 @@ module Kernel
namespace = Capistrano::Configuration::Namespaces::Namespace
if namespace.method_defined?(name) && namespace.method(name).owner == Kernel
if namespace.method_defined?(name) && namespace.instance_method(name).owner == Kernel
namespace.send :undef_method, name
end