Class: Byebug::BreakCommand
- Defined in:
- lib/byebug/commands/break.rb
Overview
Implements breakpoint functionality
Instance Attribute Summary
Attributes inherited from Command
Class Method Summary collapse
Instance Method Summary collapse
Methods included from Helpers::ParseHelper
#get_int, #parse_steps, #syntax_valid?
Methods included from Helpers::FileHelper
#get_line, #get_lines, #n_lines, #normalize, #shortpath, #virtual_file?
Methods included from Helpers::EvalHelper
#error_eval, #multiple_thread_eval, #separate_thread_eval, #silent_eval, #warning_eval
Methods inherited from Command
#arguments, columnize, #context, #frame, help, #initialize, match, to_s
Methods included from Helpers::StringHelper
Constructor Details
This class inherits a constructor from Byebug::Command
Class Method Details
.description ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/byebug/commands/break.rb', line 21 def self.description <<-EOD b[reak] [file:]line [if expr] b[reak] [module::...]class(.|#)method [if expr] They can be specified by line or method and an expression can be added for conditionally enabled breakpoints. #{short_description} EOD end |
.regexp ⇒ Object
17 18 19 |
# File 'lib/byebug/commands/break.rb', line 17 def self.regexp /^\s* b(?:reak)? (?:\s+ (\S+))? (?:\s+ if \s+(.+))? \s*$/x end |
.short_description ⇒ Object
33 34 35 |
# File 'lib/byebug/commands/break.rb', line 33 def self.short_description 'Sets breakpoints in the source code' end |
Instance Method Details
#execute ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/byebug/commands/break.rb', line 37 def execute return puts(help) unless @match[1] b = line_breakpoint(@match[1]) || method_breakpoint(@match[1]) return errmsg(pr('break.errors.location')) unless b if syntax_valid?(@match[2]) return puts(pr('break.created', id: b.id, file: b.source, line: b.pos)) end errmsg(pr('break.errors.expression', expr: @match[2])) b.enabled = false end |