From: Eugene Scripnik Date: 2002-08-23T21:16:29+09:00 Subject: Re: converting rows into structs Friday, August 23, 2002, 2:52:04 PM, you wrote: >> >> D> Is there any advantage to having it be a Struct instead of an >> D> Array of Hash'es? >> I think there is no advantage, but I really like this syntax: >> people.each { |man| puts "#{man.name} #{man.surname}" } >> >> This one is not so nice, isn't it? >> people.each { |man| puts "#{man['name']} #{man['surname']}" } D> class Hash D> def method_missing(*args) D> self[args[0].to_s] D> end D> end D> ;-) You can easily misspell method name (man.sername) with method_missing and will not notice this. In this case better way to use structs as for me. -- Best regards, Eugene [team Enticla] mailto:Eugene.Scripnik@itgrp.net