mental / rydia.net writes:

> Quoting robertj <robert_kuzelj / yahoo.com>:
>
>> hi,
>>
>> is there a String#to_sym method anywhere in the
>> statndard lib? i couldnt find anything like that
>> but maybe i missed it.
>
> If you've got a reasonably recent version of Ruby, yes.  I don't
> know about 1.6 or earlier.
>
>> its easy enough to write
>>
>> class String
>>     def to_sym
         eval ":#{dump}"
>>     end
>> end
>
> eval'ing ":#{self}" won't work if the string has spaces or anything
> like that.  In general, eval'ing strings should be an absolute last
> resort in code, because it is very difficult to make reliable.
>
> -mental
>

-- 
Christian Neukirchen  <chneukirchen / gmail.com>  http://chneukirchen.org