From: ts Date: 2002-08-23T21:26:42+09:00 Subject: Re: converting rows into structs >>>>> "E" == Eugene Scripnik writes: E> You can easily misspell method name (man.sername) with method_missing E> and will not notice this. In this case better way to use structs as E> for me. Well, in this case you can use anonymous struct row_class = Struct.new(nil, *res.names) ruby will create a new class for each call, or if you want named struct, something like this (not tested) @structname = 'SQLRow00' def find_struct(*names) ObjectSpace.each_object(Class) do |x| if x < Struct && /SQLRow\d\d\Z/ =~ x.to_s && x.members == names return x end end Struct.new(@structname.succ!, *names) end def create_struct(res) row_class = find_struct(*res.names) # ... end Guy Decoux