Module: IRB

Defined in:
lib/rish/irb.rb

Class Method Summary collapse

Class Method Details

.rish_start(ap_path = nil, hook = nil) ⇒ Object

Start a rish-shell.

This code is basically the same as IRB.start with the irb object replaced by our own version.



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
# File 'lib/rish/irb.rb', line 11

def IRB.rish_start(ap_path=nil, hook=nil)
  $0 = File::basename(ap_path, ".rb") if ap_path
  
  IRB.setup(ap_path)
  
  if @CONF[:SCRIPT]
    irb = Rish::Irb::RishIrb.new(nil, @CONF[:SCRIPT])
  else
    irb = Rish::Irb::RishIrb.new
  end

  irb.hook = hook

  @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
#    print "\n"
end