From: Matt Armstrong Date: 2003-01-04T02:46:03+09:00 Subject: How do I alias_method class methods? The code below throws the following exception: /tmp/foo.rb:10:in `alias_method': undefined method `substitute_do_it' for module `Foo' (NameError) This confuses me, because module Foo clearly has a substitute_do_it method. I want the code to print out: original do_it substitute do_it code: module Foo class << self def do_it puts "original do_it" end def substitute_do_it puts "substitute do_it" end def do_substitute module_eval { alias_method :do_it, :substitute_do_it } end end end Foo.do_it Foo.do_substitute Foo.do_it I thought I understood Ruby... ;-)