Sha256: 48bca39a49464c3ccef241add191860e69a701c50d627d68dc7b7c79879d95f2

Contents?: true

Size: 1022 Bytes

Versions: 17

Compression:

Stored size: 1022 Bytes

Contents

require 'irb'
module IRB # :nodoc:
  def self.start_session(binding)
    unless @__initialized
      args = ARGV
      ARGV.replace(ARGV.dup)
      IRB.setup(nil)
      ARGV.replace(args)
      @__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

#     trap("SIGINT") do
#       irb.signal_handle
#     end

    catch(:IRB_EXIT) do
      irb.eval_input
    end
  end
end

module Debugger
  class IRBCommand < Command # :nodoc:
    def regexp
      /^irb$/
    end
    
    def execute
      unless @state.interface.kind_of?(LocalInterface)
        print "Command is available only in local mode.\n"
        throw :debug_error
      end
      IRB.start_session(get_binding)
    end
    
    class << self
      def help_command
        'irb'
      end

      def help(cmd)
        %{
          irb\tstarts an IRB session. (EXPERIMENTAL)
        }
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
ruby-debug-0.7.5-mswin32 lib/ruby-debug/commands/irb.rb
ruby-debug-0.7.4-mswin32 lib/ruby-debug/commands/irb.rb
ruby-debug-0.7.3-mswin32 lib/ruby-debug/commands/irb.rb
ruby-debug-0.7.2-mswin32 lib/ruby-debug/commands/irb.rb
ruby-debug-0.7.1-mswin32 lib/ruby-debug/commands/irb.rb
ruby-debug-0.7-mswin32 lib/ruby-debug/commands/irb.rb
ruby-debug-0.7.1 lib/ruby-debug/commands/irb.rb
ruby-debug-0.8 cli/ruby-debug/commands/irb.rb
ruby-debug-0.7.4 lib/ruby-debug/commands/irb.rb
ruby-debug-0.8.1 cli/ruby-debug/commands/irb.rb
ruby-debug-0.9.1 cli/ruby-debug/commands/irb.rb
ruby-debug-0.9 cli/ruby-debug/commands/irb.rb
ruby-debug-0.7.2 lib/ruby-debug/commands/irb.rb
ruby-debug-0.7.3 lib/ruby-debug/commands/irb.rb
ruby-debug-0.9.2 cli/ruby-debug/commands/irb.rb
ruby-debug-0.7 lib/ruby-debug/commands/irb.rb
ruby-debug-0.7.5 lib/ruby-debug/commands/irb.rb