From: Daniel Martin Date: 2007-08-19T02:59:17+09:00 Subject: Re: Execute ruby commands in a program Haze Noc writes: > Is there anyway to be able to run live ruby code and print the answers > (i dont really know how to put it) so like.. > > Ruby: name = 'john'; puts "Hi" if name == 'john' > Program: Hi > > Sounds weird i know, But if Anyone out there understands me that would > be great.. > > I want to stay away from shell one liners like ruby -e "code here" I have a bit of trouble understanding what it is you want to have happen, especially since you specifically wish to avoid 1-liners. Is "irb" (bundled with ruby) what you want? Absent that, at the shell you can just run "ruby", type some ruby code, then type __END__ on a line by itself, (that's two underscores, then END, then two more underscores) and the code will then run. Is either of this what you wanted? -- s=%q( Daniel Martin -- martin@snowplow.org puts "s=%q(#{s})",s.to_a.last ) puts "s=%q(#{s})",s.to_a.last