How to run ruby files?
问题 Example I have the file test.rb: puts "test test test" How do I run this file in the ruby console? 回答1: load 'test.rb' Do you mean Rails console? (Same thing, but the question is tagged rails.) 回答2: load("test.rb") should do the trick in irb . 回答3: On Mac you can run in three different ways from the terminal Method 1 On Terminal irb (Interactive Ruby Shell) for line by line execution then quit command to be out of irb. Method 2 As ruby is Interpreted language we can run by one command on