#!/usr/bin/env ruby # # This program is an interactive shell for Rumai. # # Command-line options and arguments given to this program are passed # directly to the underlying IRB (the interactive Ruby shell) session. # require 'irb' require 'irb/completion' # enable TAB-completion module IRB ## # Starts an IRB session *inside* the given object. # # This code was adapted from a snippet on Massimiliano Mirra's website: # http://www.therubymine.com/articles/2007/01/29/programmare-dallinterno # def self.start_session context IRB.setup nil env = IRB::WorkSpace.new(context) irb = IRB::Irb.new(env) IRB.conf[:MAIN_CONTEXT] = irb.context catch :IRB_EXIT do irb.eval_input end end end # start IRB session $LOAD_PATH << File.expand_path('../../lib', __FILE__) require 'rumai' IRB.start_session Rumai