David A. Black wrote: > Hi -- > > On Mon, 29 Nov 2004, Sam Stephenson wrote: > > >>On Mon, 29 Nov 2004 11:31:06 +0900, Gavin Sinclair >><gsinclair / soyabean.com.au> wrote: >> >>> Class.get_class >>> Class.get_class("Test::Unit") -> Test::Unit >>> Class.get_class("not-a-class") -> exception >>> >>> # Should 'get_class' be in Class or in Kernel? >> >>Why not String? >> "Test::Unit".to_class # => Test::Unit >> >>My justification: it's analogous to String#to_sym. > > > I'm not sure what either of these adds to const_get -- or, to put it > another way, why there should be a special method to do (essentially) > a const_get only for strings that represent class names. Well, IIRC, const_get doesn't work with symbols that contain "::". In other words, const_get( "Test::Unit" ) would fail--you'd have to do const_get("Test").const_get("Unit"), which becomes cumbersome. I can think of several instances in my Net::SSH and Net::SFTP stuff alone where a standard #get_class method would have been useful (though far from necessary). - Jamis -- Jamis Buck jgb3 / email.byu.edu http://www.jamisbuck.org/jamis