From: Mike Harris Date: 2006-06-20T05:19:59+09:00 Subject: Re: associative array naming indirection uh ......... what's the error dan donaldson wrote: >I have an array of names in string form as an instance var. The class >the array is in has a method that takes an array of string values. > >I want to construct an associative array such that the names in the >first array are the keys to the values in the received array. > >this throws an error: >-------------- > def initialize > @labels = ['prov', 'area', 'zone', district', 'postalcode', >'city_prov', 'addr'] > @pageData = {} > end > > def adddata(data) > max = data.length > max -= 1 > 0.upto(max) {|i| @pageData[@labels[i]] => data[i] } > end > >-------------- > >obviously, some giant conceptual leap needs to be made, or its a >miniscule typo. (methinks the former) > >Anyone got advice? > > >