Module: IRB

Defined in:
lib/webdrone.rb

Class Method Summary collapse

Class Method Details

.start_session(binding) ⇒ Object



51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/webdrone.rb', line 51

def self.start_session(binding)
  unless $a0_irb_setup_done
    IRB.setup(nil)
    $a0_irb_setup_done = true
  end

  workspace = WorkSpace.new(binding)

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

  @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.irb_at_exit
  end
end