From: Robert Klemme Date: 2007-02-14T22:55:15+09:00 Subject: Re: Dynamic function calls On 14.02.2007 14:46, Tomas Fischer wrote: > Hi, > > I want to write an installer, which checks, if sth. is present on the > target system and if not, the installer will install it. For example, > the installer checks if zip is installed. > > So I have tons of check functions and corresponding install funtions: > > def check_zip > ... > return true / false > end > > def install_zip > ... > system(apt-get install zip) > end > > My idea is to use an array, which contains the result of the checking > process > array= [zip, ...] means, that we have to install zip. Is it possible to > "connect" it > to the corresponding install function? > > for each element in array > call install_ array[index] > end array.each do |name| send "install_#{name}" end Kind regards robert