Simple
puts Readline::HISTORY.to_a
Found answer here
def main#option parsing and execution code hereendif __FILE__ == $0main()end
This way the main function will only be automatically called if the script is being executed on the command line.
And in irb, you can call your functions and classes as you see fit for testing without triggering your whole script to run.
Note that this is similar to the python __main__ test if you are coming from a python background.
#!/usr/bin/env ruby#!/usr/bin/ruby
require 'script-name'load 'script-name'exit 0exit 27$stderr.puts "error: problem ...."