Class: Byebug::PryCommand

Inherits:
Command
  • Object
show all
Defined in:
lib/byebug/commands/pry.rb

Overview

Enter Pry from byebug’s prompt

Instance Attribute Summary

Attributes inherited from Command

#processor

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Command

#arguments, columnize, #context, #frame, help, #initialize, match, to_s

Methods included from Helpers::StringHelper

#camelize, #deindent, #prettify

Constructor Details

This class inherits a constructor from Byebug::Command

Class Method Details

.descriptionObject



17
18
19
20
21
22
23
# File 'lib/byebug/commands/pry.rb', line 17

def self.description
  <<-DESCRIPTION
    pry

    #{short_description}
  DESCRIPTION
end

.regexpObject



13
14
15
# File 'lib/byebug/commands/pry.rb', line 13

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

.short_descriptionObject



25
26
27
# File 'lib/byebug/commands/pry.rb', line 25

def self.short_description
  "Starts a Pry session"
end

Instance Method Details

#executeObject



29
30
31
32
33
34
35
36
37
38
39
# File 'lib/byebug/commands/pry.rb', line 29

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

  begin
    require "pry"
  rescue LoadError
    return errmsg(pr("pry.errors.not_installed"))
  end

  Pry.start(context.frame._binding)
end