Hi --

On Sun, 16 Sep 2007, 7stud -- wrote:

> 7stud -- wrote:
>> The symbol argument
>> should refer to a string, and that string should be the name of a
>> method.  send() then executes the method:
>
> After editing that sentence a couple of times, I completely changed the
> meaning into something quite confusing.  A symbol *always* refers to a
> string.  That should read:

I'm not sure I'd put it that way. A symbol, like a string, can always
be represented by characters, but I don't think a symbol actually
refers to a string, any more than the string refers to the symbol. But
I may be misunderstanding what you mean.

> The symbol argument should refer to a string that is the name of a
> method.  To create that symbol you take the method name and put a ":" in
> front of it.

send takes a string too:

   obj.send("some_method")

so if you've got the name of a method as a string in a variable, you
can just use that directly.


David

-- 
* Books:
   RAILS ROUTING (new! http://www.awprofessional.com/title/0321509242)
   RUBY FOR RAILS (http://www.manning.com/black)
* Ruby/Rails training
     & consulting:  Ruby Power and Light, LLC (http://www.rubypal.com)