Sha256: 5e63eb165cdf5221d9d961daaf1b05cd7709be0b36fd83ca942b1a38416855eb
Contents?: true
Size: 1.15 KB
Versions: 3
Compression:
Stored size: 1.15 KB
Contents
module Byebug class ConditionCommand < Command # :nodoc: def regexp /^\s* cond(?:ition)? (?:\s+(\d+)\s*(.*))?$/ix end def execute return errmsg "\"condition\" must be followed by " \ "breakpoint number and expression\n" unless @match[1] breakpoints = Byebug.breakpoints.sort_by{|b| b.id } largest = breakpoints.inject(0) do |tally, b| tally = b.id if b.id > tally end return print "No breakpoints have been set.\n" if 0 == largest return unless pos = get_int(@match[1], "Condition", 1, largest) breakpoints.each do |b| if b.id == pos b.expr = @match[2].empty? ? nil : @match[2] break end end end class << self def names %w(condition) end def description %{ cond[ition] nnn[ expr] Specify breakpoint number nnn to break only if expr is true. nnn is an integer and expr is an expression to be evaluated whenever breakpoint nnn is reached. If no expression is specified, the condition is removed. } end end end end # module Byebug
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
byebug-1.4.1 | lib/byebug/commands/condition.rb |
byebug-1.4.0 | lib/byebug/commands/condition.rb |
byebug-1.3.1 | lib/byebug/commands/condition.rb |