blob: 0e6790af95176c0aae3f55490ea4037300b120f4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
require 'irb'
module IRB
@setup_done = false
def IRB.start_within(binding)
unless @setup_done
# make IRB ignore our command line arguments
begin
saved_args = ARGV.shift(ARGV.size)
IRB.setup(nil)
ensure
ARGV.replace(saved_args)
end
@setup_done = true
end
workspace = WorkSpace.new(binding)
irb = Irb.new(workspace)
@CONF[:IRB_RC].call(irb.context) if @CONF[:IRB_RC]
@CONF[:MAIN_CONTEXT] = irb.context
trap("SIGINT") do
irb.signal_handle
end
begin
catch(:IRB_EXIT) do
irb.eval_input
end
ensure
irb_at_exit
end
end
end
|