Sha256: 3449d8c9cd479061b30a2d16277c3e31e6a1e4717e993a723771e42913c51b77

Contents?: true

Size: 942 Bytes

Versions: 6770

Compression:

Stored size: 942 Bytes

Contents

# frozen_string_literal: true

require_relative "../command"
require "irb"
require "English"

module Byebug
  #
  # Enter IRB from byebug's prompt
  #
  class IrbCommand < Command
    self.allow_in_post_mortem = true

    def self.regexp
      /^\s* irb \s*$/x
    end

    def self.description
      <<-DESCRIPTION
        irb

        #{short_description}
      DESCRIPTION
    end

    def self.short_description
      "Starts an IRB session"
    end

    def execute
      return errmsg(pr("base.errors.only_local")) unless processor.interface.instance_of?(LocalInterface)

      # @todo IRB tries to parse $ARGV so we must clear it (see #197). Add a
      #   test case for it so we can remove this comment.
      with_clean_argv { IRB.start }
    end

    private

    def with_clean_argv
      saved_argv = $ARGV.dup
      $ARGV.clear
      begin
        yield
      ensure
        $ARGV.concat(saved_argv)
      end
    end
  end
end

Version data entries

6,770 entries across 6,767 versions & 30 rubygems

Version Path
cybrid_api_organization_ruby-0.123.124 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/commands/irb.rb
cybrid_api_id_ruby-0.123.124 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/commands/irb.rb
cybrid_api_bank_ruby-0.123.123 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/commands/irb.rb
cybrid_api_id_ruby-0.123.123 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/commands/irb.rb
cybrid_api_organization_ruby-0.123.123 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/commands/irb.rb
cybrid_api_bank_ruby-0.123.122 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/commands/irb.rb
cybrid_api_organization_ruby-0.123.122 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/commands/irb.rb
cybrid_api_id_ruby-0.123.122 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/commands/irb.rb
cybrid_api_bank_ruby-0.123.121 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/commands/irb.rb
cybrid_api_id_ruby-0.123.121 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/commands/irb.rb
cybrid_api_organization_ruby-0.123.121 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/commands/irb.rb
cybrid_api_bank_ruby-0.123.120 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/commands/irb.rb
cybrid_api_organization_ruby-0.123.120 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/commands/irb.rb
cybrid_api_id_ruby-0.123.120 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/commands/irb.rb
avalara_sdk-24.12.0 vendor/bundle/ruby/2.7.0/gems/byebug-11.1.3/lib/byebug/commands/irb.rb
cybrid_api_bank_ruby-0.123.119 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/commands/irb.rb
cybrid_api_organization_ruby-0.123.119 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/commands/irb.rb
cybrid_api_id_ruby-0.123.119 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/commands/irb.rb
cybrid_api_bank_ruby-0.123.118 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/commands/irb.rb
cybrid_api_id_ruby-0.123.118 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/commands/irb.rb