From: Peter Vanbroekhoven Date: 2005-08-31T00:01:23+09:00 Subject: Re: Method behaves differently when called using #send On Tue, 30 Aug 2005, David A. Black wrote: > I see what you mean; it's very magic. I can't think of a way to > implement it in Ruby, and even though someone will be able to with dl > or whatever, it will still be too magic :-) Actually... Here's an implementation using the very thing that started this thread: class Object private :send def method_missing(m, *args, &blk) if m == :send eval "self.#{args[0]}(*args[1..-1], &blk)" else eval "#{m}(*args, &blk)" end end end class A def do_sth puts "hello" end private :do_sth end A.new.instance_eval { do_sth } # => prints "hello" A.new.do_sth # => raises NoMethodError It does no error checking in send, and I don't know if it reacts correctly to something like send(:send, ...), but you should get the gist. Peter