Module: IRB

Defined in:
app/irb.rb

Overview

:nodoc:

Defined Under Namespace

Modules: ExtendCommand

Class Method Summary collapse

Class Method Details

.start_session(binding, dbg_cmdproc, conf = {}) ⇒ Object



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
98
99
100
101
102
103
104
105
106
107
# File 'app/irb.rb', line 71

def self.start_session(binding, dbg_cmdproc, conf={})
  unless @__initialized

    # Set to run the standard trepanx IRB profile
    irbrc = File.expand_path(File.join(File.dirname(__FILE__), 
                                       %w(.. data irbrc)))
    ENV['IRBRC'] = irbrc

    args = ARGV.dup
    ARGV.replace([])
    IRB.setup(nil)
    ARGV.replace(args)
    
    # If the user has a IRB profile, run that now.
    if ENV['TREPANX_IRB']
      ENV['IRBRC'] = ENV['TREPANX_IRB']
      @CONF[:RC_NAME_GENERATOR]=nil
      IRB.run_config
    end

    @__initialized = 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
  conf.each {|k, v| @CONF[k] = v}
  # A copy of this back_trace_limit is already active. How? 
  IRB.CurrentContext.back_trace_limit = @CONF[:BACK_TRACE_LIMIT]

  catch(:IRB_EXIT) do
    irb.eval_input
  end
end