From: Frank Church Date: 2007-06-26T10:04:16+09:00 Subject: Some help needed with understanding ruby hashes If a ruby hash rubyhash has a key such as "hashkey" is there a way of retrieving the value by the expression rubyhash["hashkey"] ? It only seems logical that is rubyhash.has_key?("hashkey") returns true rubyhash["hashkey"] should return a value, but it always gives an error. I know the same can be achieved via with rubyhash.values_at("hashkey") but it appears so inelegant to me. I am trying to create an erb template which will use the hash keys here such as directory1 directory2 for each directory and the for each directory use hash key s such as directory, archivename etc, but I find values_at rather inelegant. I sorely hope there is some aspect to ruby hashes syntax that I am missing. directories : directory1 : directory : /thisdirectory/yada/yada/yada archivename : archivename01 updatemode : updatemode01 encryptkey : encryptkey01 configdir : configdir01 workdir : workingdir01 storagedir : storagedir01 logsdir : logsdir01 directory2 : directory : /thisdirectory/yada2/yada2/yada2 archivename : archivename02 updatemode : updatemode02 encryptkey : encryptkey02 configdir : configdir02 workdir : workingdir02 storagedir : storagedir02 logsdir : logsdir02 -- Posted via http://www.ruby-forum.com/.