From: Bryan Richardson Date: 2008-01-09T07:25:59+09:00 Subject: Re: Using string variable to call a method ------=_Part_6878_31723117.1199831162579 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Along these same lines, is it possible to do a require and include dynamically, getting the name of the file to require and module to include from a string? On Jan 7, 2008 5:25 PM, Daniel Finnie wrote: > In general, the send method is preferred over evalling a string when > possible. > > In addition to send "say_#{str}", you can do method("say_#{str}".to_sym) > .call. > > Dan > > > On 1/7/08, Thomas Wieczorek wrote: > > > > You can use: eval, instance_eval, class_eval, module_eval oder send > > The different evals are described here: > > http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/192513 > > (click on the "N" to read the next message in the thread) > > send is as far as I understand it, used to send messages to objects. > > Keep in mind that method calls are messages send to objects. > > > > > ------=_Part_6878_31723117.1199831162579--