Class: Byebug::BreakCommand
- Defined in:
- lib/byebug/commands/break.rb
Overview
Implements breakpoint functionality
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
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
.description ⇒ Object
36 37 38 39 40 41 42 43 |
# File 'lib/byebug/commands/break.rb', line 36 def description prettify <<-EOD b[reak] [file:]line [if expr] b[reak] [module::...]class(.|#)method [if expr] Set breakpoint to some position, (optionally) if expr == true EOD end |
.names ⇒ Object
32 33 34 |
# File 'lib/byebug/commands/break.rb', line 32 def names %w(break) end |
Instance Method Details
#execute ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/byebug/commands/break.rb', line 15 def execute return puts(self.class.help) unless @match[1] brkpt = line_breakpoint(@match[1]) || method_breakpoint(@match[1]) if syntax_valid?(@match[2]) return puts( pr('break.created', id: brkpt.id, file: brkpt.source, line: brkpt.pos) ) end errmsg(pr('break.errors.expression', expr: @match[2])) brkpt.enabled = false rescue => e errmsg(e.) end |
#regexp ⇒ Object
11 12 13 |
# File 'lib/byebug/commands/break.rb', line 11 def regexp /^\s* b(?:reak)? (?:\s+ (\S+))? (?:\s+ if \s+(.+))? \s*$/x end |