Module: IRB

Defined in:
lib/webdrone.rb

Class Method Summary collapse

Class Method Details

.start_session(binding) ⇒ Object



69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/webdrone.rb', line 69

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