Class: PryByebug::BreakCommand

Inherits:
Pry::ClassCommand
  • Object
show all
Includes:
Helpers::Breakpoints, 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::Breakpoints

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

Instance Method Details

#options(opt) ⇒ Object



46
47
48
49
50
51
52
53
54
55
56
# File 'lib/pry-byebug/commands/breakpoint.rb', line 46

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



58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/pry-byebug/commands/breakpoint.rb', line 58

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