Execution problem in ruby

how to execute a ruby program which is inside a string ?
for example
ex.rb

puts "start "
temp="(1..10).each do |count| print count end "
puts "end"

how to execute the source code in temp(String object)

···

--
Posted via http://www.ruby-forum.com/.

Pokkai Dokkai wrote:

how to execute a ruby program which is inside a string ?

eval

···

--
NP: Katatonia - Right Into The Bliss
Jabber: sepp2k@jabber.org
ICQ: 205544826

eval(temp)

Hope this helps.

Douglas F Shearer
dougal.s@gmail.com

···

On 10 Aug 2007, at 17:51, Pokkai Dokkai wrote:

how to execute the source code in temp(String object)

eval(string), but this is always what NOT-WHAT-YOU-WANT-TO-DO.

···

On Friday 10 August 2007 09:51:55 am Pokkai Dokkai wrote:

how to execute a ruby program which is inside a string ?
for example
ex.rb

puts "start "
temp="(1..10).each do |count| print count end "
puts "end"

how to execute the source code in temp(String object)

--
Konrad Meyer <konrad@tylerc.org> http://konrad.sobertillnoon.com/