bin/rumai in rumai-2.0.2 vs bin/rumai in rumai-2.1.0
- old
+ new
@@ -3,35 +3,47 @@
# This program is an interactive shell for Rumai.
#
# Usage:
#
# rumai [Options]
-# rumai [Options] -- irb_args
+# rumai [Options] -- Arguments
#
-# irb_args: Command-line options and arguments that should
+# Arguments: Command-line options and arguments that should
# be passed to `irb`, the interactive Ruby shell.
#
# Options:
#
+#--
+# Copyright 2007 Suraj N. Kurapati
+# See the LICENSE file for details.
+#++
+
require 'rubygems'
-gem 'inochi', '~> 0'
+gem 'inochi', '~> 1'
require 'inochi'
Inochi.main :Rumai
require 'irb'
require 'irb/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 aContextObj
- setup nil
- session = Irb.new(WorkSpace.new(aContextObj))
- @CONF[:MAIN_CONTEXT] = session.context
- catch(:IRB_EXIT) { session.eval_input }
+ #
+ 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
IRB.start_session Rumai