Module: IRB

Defined in:
lib/3rdparty/breakpoint.rb

Class Method Summary collapse

Class Method Details

.start(ap_path = nil, main_context = nil) ⇒ Object



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
# File 'lib/3rdparty/breakpoint.rb', line 5

def IRB.start(ap_path = nil, main_context = nil)
  $0 = File::basename(ap_path, ".rb") if ap_path

  # suppress some warnings about redefined constants
  old_verbose, $VERBOSE = $VERBOSE, nil
  IRB.setup(ap_path)
  $VERBOSE = old_verbose

  if @CONF[:SCRIPT]
    irb = Irb.new(main_context, @CONF[:SCRIPT])
  else
    irb = Irb.new(main_context)
  end

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

  trap("SIGINT") do
    irb.signal_handle
  end
  
  catch(:IRB_EXIT) do
    irb.eval_input
  end
end