P
Philipp Hofmann
Hello,
I was hoping that the following snippet would output
test_method
instead it raises an 'undefined method'.
module Proxy
def self.append_features(mod)
mod.extend(ClassMethods)
end
module ClassMethods
def proxy_method(name)
self.class.senddefine_method, name) { puts "called #{name}" }
end
end
end
class ProxyTest
include Proxy
proxy_method :test_method
end
proxy = ProxyTest.new
proxy.test_method
Any hints greatly appreciated.
g phil
I was hoping that the following snippet would output
test_method
instead it raises an 'undefined method'.
module Proxy
def self.append_features(mod)
mod.extend(ClassMethods)
end
module ClassMethods
def proxy_method(name)
self.class.senddefine_method, name) { puts "called #{name}" }
end
end
end
class ProxyTest
include Proxy
proxy_method :test_method
end
proxy = ProxyTest.new
proxy.test_method
Any hints greatly appreciated.
g phil