From: Karl Voit Date: 2006-10-06T16:50:11+09:00 Subject: Using configuration files (replacing shellscripts) Hi! I want to use configuration files in order to save values, directories, and files. I did some googeling to find out that the ruby community often suggests ruby-files (hashes) to save configurations. These rb-files are read in by interpreting. (btw, anyone suggests a cool part of code for this with errorhandling and so on?) But I do have some problems with that method: ,----[ shellscript configuration example ] | export value1=42 | export value2=23 | export path1=/some/where | export path2=$path1/else | export file1=$path1/foo | export file2=$path2/bar `---- First, I tried to replace it 1:1 using ruby but failed when it came to reusing values: ,----[ woun't run ] | $config = { | 'value1' => '42', | 'value2' => '23', | 'path1' => '/some/where', | 'path2' => $config['path1']+'/else', | [...] | } `---- Is there a way to accomplish this in another way? (using self or something like that) Meanwhile I did a workaround: ,----[ Workaround ] | $directories = { | 'path1' => '/some/where', | 'path2' => '/some/where/else', # redundancy! :-( | [...] | } | | $files = { | 'file1' = $directories['path1']+'/foo', # problem! | [...] | } | | $values = { ... } `---- This did not work out either. How can I solve my problem? -- Karl Voit