Module: IRB

Defined in:
lib/live_console.rb

Overview

We need to make a couple of changes to the IRB module to account for using a weird I/O method and re-starting IRB from time to time.

Defined Under Namespace

Classes: Context, Irb

Class Method Summary collapse

Class Method Details

.start_with_io(io, &block) ⇒ Object

Overridden a la FXIrb to accomodate our needs.



83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'lib/live_console.rb', line 83

def IRB.start_with_io(io, &block)
	unless @inited
		setup '/dev/null'
		IRB.parse_opts
		IRB.load_modules
		@inited = true
	end

	irb = Irb.new(nil, io, io)

	@CONF[:IRB_RC].call(irb.context) if @CONF[:IRB_RC]
	@CONF[:MAIN_CONTEXT] = irb.context
	@CONF[:PROMPT_MODE] = :INF_RUBY

	catch(:IRB_EXIT) { 
		begin
			irb.eval_input
		rescue StandardError => e
			irb.print([e.to_s, e.backtrace].flatten.join("\n") + "\n")
			retry
		end
	}
	print "\n"
end