Class: PryByebug::BreakCommand

Inherits:
Pry::ClassCommand
  • Object
show all
Includes:
Helpers::Breakpoints, Helpers::Location, Helpers::Multiline
Defined in:
lib/pry-byebug/commands/breakpoint.rb

Overview

Add, show and remove breakpoints

Instance Method Summary collapse

Methods included from Helpers::Multiline

#check_multiline_context

Methods included from Helpers::Location

current_file

Methods included from Helpers::Breakpoints

#bold_puts, #breakpoints, #max_width, #print_breakpoints_header, #print_full_breakpoint, #print_short_breakpoint

Instance Method Details

#options(opt) ⇒ Object



50
51
52
53
54
55
56
57
58
59
60
# File 'lib/pry-byebug/commands/breakpoint.rb', line 50

def options(opt)
  defaults = { argument: true, as: Integer }

  opt.on :c, :condition, "Change condition of a breakpoint.", defaults
  opt.on :s, :show, "Show breakpoint details and source.", defaults
  opt.on :D, :delete, "Delete a breakpoint.", defaults
  opt.on :d, :disable, "Disable a breakpoint.", defaults
  opt.on :e, :enable, "Enable a disabled breakpoint.", defaults
  opt.on :'disable-all', "Disable all breakpoints."
  opt.on :'delete-all', "Delete all breakpoints."
end

#processObject



62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/pry-byebug/commands/breakpoint.rb', line 62

def process
  return if check_multiline_context

  PryByebug.check_file_context(target)

  option, = opts.to_hash.find { |key, _value| opts.present?(key) }
  return send(option_to_method(option)) if option

  return new_breakpoint unless args.empty?

  print_all
end