Hi -- On Thu, 21 Aug 2008, Nick Brown wrote: > So the problem doesn't seem to be with sub! at all. It's with cgi. > > If I get the variable "a" using the cgi code above, then I create string > "b": > > a = cgi['a'] > b = String.new > > a.class > => String > b.class > => String > > So they should have the same methods since they are the same class. Not necessarily. Objects do what they do. Classes are mainly a way to launch objects into object-space, after which they may or may not continue to behave the way they did when they were first created. > However, "a" seems to have extra methods. > a.first > => "hi" > b.first > NoMethodError: undefined method `first' for "":String > > > It seems the cgi object is returning strings that aren't really strings. > If that's the case, isn't it a bug that cgi['a'].class returns "String" > when it is really something else? No, as long as the API of the object is correctly documented. David -- Rails training from David A. Black and Ruby Power and Light: Intro to Ruby on Rails January 12-15 Fort Lauderdale, FL Advancing with Rails January 19-22 Fort Lauderdale, FL See http://www.rubypal.com for details and updates!