Module: IRB

Defined in:
lib/fxirb.rb

Class Method Summary collapse

Class Method Details

.start_in_fxirb(im) ⇒ Object



125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
# File 'lib/fxirb.rb', line 125

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