Class: Byebug::PryCommand

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

Overview

Enter Pry from byebug’s prompt

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Command

commands, find, format_subcmd, format_subcmds, help, inherited, #initialize, #match

Methods included from StringFunctions

#camelize, #prettify

Methods included from FileFunctions

#get_line, #get_lines, #n_lines, #normalize

Methods included from ParseFunctions

#get_int, #parse_steps, #syntax_valid?

Constructor Details

This class inherits a constructor from Byebug::Command

Class Method Details

.descriptionObject



31
32
33
34
35
# File 'lib/byebug/commands/pry.rb', line 31

def description
  prettify <<-EOD
    pry  Starts a Pry session.
  EOD
end

.namesObject



27
28
29
# File 'lib/byebug/commands/pry.rb', line 27

def names
  %w(pry)
end

Instance Method Details

#executeObject



12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/byebug/commands/pry.rb', line 12

def execute
  unless @state.interface.is_a?(LocalInterface)
    return errmsg(pr('base.errors.only_local'))
  end

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

  get_binding.pry
end

#regexpObject



8
9
10
# File 'lib/byebug/commands/pry.rb', line 8

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