module PryByebug::Helpers::Breakpoints
def bold_puts(msg)
Prints a message with bold font.
def bold_puts(msg) output.puts(text.bold(msg)) end
def breakpoints
Byebug's array of breakpoints.
def breakpoints Pry::Byebug::Breakpoints end
def current_file
location.
Current file in the target binding. Used as the default breakpoint
def current_file target.eval("__FILE__") end
def max_width
Max width of breakpoints id column
def max_width breakpoints.last ? breakpoints.last.id.to_s.length : 1 end
def print_breakpoints_header
Prints a header for the breakpoint list.
def print_breakpoints_header header = "#{' ' * (max_width - 1)}# Enabled At " output.puts <<-BREAKPOINTS.gsub(/ {8}/, "") #{text.bold(header)} #{text.bold('-' * header.size)} BREAKPOINTS end
def print_full_breakpoint(breakpoint)
Includes surrounding code at that point.
Print out full information about a breakpoint.
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 "#{text.bold('Condition:')} #{breakpoint.expr}\n" else "" end output.puts <<-BREAKPOINT.gsub(/ {8}/, "") #{text.bold(header)} #{breakpoint} (#{status}) #{condition} #{code} BREAKPOINT end
def print_short_breakpoint(breakpoint)
Print out concise information about a breakpoint.
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