module PryByebug::Helpers::Breakpoints
Common helpers for breakpoint related commands
Public Instance Methods
bold_puts(msg)
click to toggle source
Prints a message with bold font.
# File lib/pry-byebug/helpers/breakpoints.rb, line 20 def bold_puts(msg) output.puts(bold(msg)) end
breakpoints()
click to toggle source
Byebug's array of breakpoints.
# File lib/pry-byebug/helpers/breakpoints.rb, line 13 def breakpoints Pry::Byebug::Breakpoints end
max_width()
click to toggle source
Max width of breakpoints id column
# File lib/pry-byebug/helpers/breakpoints.rb, line 76 def max_width breakpoints.last ? breakpoints.last.id.to_s.length : 1 end
print_breakpoints_header()
click to toggle source
Prints a header for the breakpoint list.
# File lib/pry-byebug/helpers/breakpoints.rb, line 62 def print_breakpoints_header header = "#{' ' * (max_width - 1)}# Enabled At " output.puts <<-BREAKPOINTS.gsub(/ {8}/, "") #{bold(header)} #{bold('-' * header.size)} BREAKPOINTS end
print_full_breakpoint(breakpoint)
click to toggle source
Print out full information about a breakpoint.
Includes surrounding code at that point.
# File lib/pry-byebug/helpers/breakpoints.rb, line 29 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_short_breakpoint(breakpoint)
click to toggle source
Print out concise information about a breakpoint.
# File lib/pry-byebug/helpers/breakpoints.rb, line 51 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