[Rails] Re: Accessing Raw Post Data
Doug Jolley wrote:
>> irb(main):001:0> "foo".to_sym.class
>> => Symbol
>>
>> irb(main):002:0> :foo.to_s.class
>> => String
>
> VIOLA!!!
Viola: string instrument that I happen to play.
Voilà: French for "there it is".
:)
> That seems to be the missing link. Thanks ever so much. :)
Great. Now the lecture. Couldn't figure out how turn a String into a
Symbol? Instead of posting to the list, your thought process should
have been something like this:
I need a method to turn a String into a Symbol.
That method deals with an instance of class String.
Therefore, it will probably be an instance method on String, or possibly
a constructor on Symbol.
OK, I'll look in the rdoc for String and Symbol. I'll pay particular
attention to the to_* methods, since that's the Ruby convention for type
conversion.
If I can't find it there, I'll search the Web.
If all else fails, I'll ask the list.
That is how to do efficient Ruby research.
>
> ... doug
Best,
--
Marnen Laibow-Koser
http://www.marnen.org
marnen@marnen.org
--
Posted via http://www.ruby-forum.com/.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home