From: Daniel Schierbeck Date: 2006-05-10T22:51:52+09:00 Subject: Re: Intantiating a class by name Logan Capaldo wrote: > > On May 10, 2006, at 8:32 AM, Daniel Schierbeck wrote: > >> Come to think of it, Symbol doesn't define #to_str, so maybe this is >> better: >> >> name.to_sym.to_str.split(... > > You're right it doesn't, so how does explicitly converting name into a > symbol and then calling to_str help? > > Ah nevermind I see from your code this was probably a typo. Yup, it was supposed to read `to_sym.to_s' > Then riddle me this, why the double conversion? > > to_sym.to_s should just be squished into to_s. It may just be my own preference, but I think it's nice to restrict the `types' of arguments a method can take -- not by class, but by defined methods. So when you say that #get_const takes a symbol as an argument, you know you can give it every object that responds to #to_sym. But yes, #to_s could be used. Cheers, Daniel