module PryByebug::Helpers::Breakpoints
Common helpers for breakpoint related commands
Public Instance Methods
Source
# File lib/pry-byebug/helpers/breakpoints.rb, line 21 def bold_puts(msg) output.puts(bold(msg)) end
Prints a message with bold font.
Source
# File lib/pry-byebug/helpers/breakpoints.rb, line 14 def breakpoints Pry::Byebug::Breakpoints end
Byebug’s array of breakpoints.
Source
# File lib/pry-byebug/helpers/breakpoints.rb, line 77 def max_width breakpoints.last ? breakpoints.last.id.to_s.length : 1 end
Max width of breakpoints id column
Source
# File lib/pry-byebug/helpers/breakpoints.rb, line 63 def print_breakpoints_header header = "#{' ' * (max_width - 1)}# Enabled At " output.puts <<-BREAKPOINTS.gsub(/ {8}/, "") #{bold(header)} #{bold('-' * header.size)} BREAKPOINTS end
Prints a header for the breakpoint list.
Source
# File lib/pry-byebug/helpers/breakpoints.rb, line 30 def print_full_breakpoint(breakpoint) header = "Breakpoint #{breakpoint.id}:" status = breakpoint.enabled? ? "Enabled" : "Disabled" code = breakpoint.source_code.with_line_numbers.to_s condition = if breakpoint.expr "#{bold('Condition:')} #{breakpoint.expr}\n" else "" end output.puts <<-BREAKPOINT.gsub(/ {8}/, "") #{bold(header)} #{breakpoint} (#{status}) #{condition} #{code} BREAKPOINT end
Print out full information about a breakpoint.
Includes surrounding code at that point.
Source
# File lib/pry-byebug/helpers/breakpoints.rb, line 52 def print_short_breakpoint(breakpoint) id = format("%*d", max_width, breakpoint.id) status = breakpoint.enabled? ? "Yes" : "No " expr = breakpoint.expr ? " #{breakpoint.expr} " : "" output.puts(" #{id} #{status} #{breakpoint}#{expr}") end
Print out concise information about a breakpoint.