Hi --

On Tue, 26 Jul 2005, Sam Kong wrote:

> Thanks, rcoder!
>
> But, what bothers me is the following case.
>
> class Foo
>   def foo
>     puts "foo"
>   end
> end
>
> Foo.new.send(:foo)
>
> In this case, :foo is not just a string-like thing.
> It seems more like the one in the quoted text.
>
> What do you think?

The :foo in send(:foo) is just a symbol (instance of Symbol :-).  It
has no special status beyond that.  It happens to match the name of a
method, but the symbol object has no relation to that method.

send is defined so that it can take a symbol or a string; you could
also do:

   Foo.new.send("foo")

which can be handy when you need to do string interpolation to get the
name of the method.


David

-- 
David A. Black
dblack / wobblini.net