Um, this sounds like ‘irb’. Depending on what OS you’re on and how
you installed ruby, you should just be able to type ‘irb’ at the
command-line. That sounds like what you’re after.
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.
Sorry its quite hard to explain, Its not IRB, because i want to actually
run a command from within another ruby script… Lets say i wanted to do
a 1 liner from within the program i could do something like…
Thanks, i looked it up and coded something pretty much the same except
something like message = eval(“#{$1}”)… when i print out the return it
just print nil
Thanks, i looked it up and coded something pretty much the same except
something like message = eval(“#{$1}”)… when i print out the return it
just print nil
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.