Module: IRB

Defined in:
lib/fxirb.rb

Class Method Summary collapse

Class Method Details

.start_in_fxirb(im) ⇒ Object



108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
# File 'lib/fxirb.rb', line 108

def IRB.start_in_fxirb(im)
	if RUBY_VERSION < "1.7.3"
		IRB.initialize(nil)
		IRB.parse_opts
		IRB.load_modules
	else
		IRB.setup(nil)
	end

	irb = Irb.new(nil, im)    

	@CONF[:IRB_RC].call(irb.context) if @CONF[:IRB_RC]
	@CONF[:MAIN_CONTEXT] = irb.context
	trap("SIGINT") do
		irb.signal_handle
	end

	class << irb.context.workspace.main
		def gets
			inp = IRB.conf[:MAIN_CONTEXT].io
			inp.gets_mode = true
			retval = IRB.conf[:MAIN_CONTEXT].io.gets
			inp.gets_mode = false
			retval
		end
	end

	catch(:IRB_EXIT) do
		irb.eval_input
	end
	print "\n"
end