In Files

  • debug-1.4.0/lib/debug/color.rb

DEBUGGER__::Color

Public Instance Methods

color_pp(obj, width) click to toggle source
 
               # File debug-1.4.0/lib/debug/color.rb, line 49
def color_pp obj, width
  with_inspection_error_guard do
    if !CONFIG[:no_color]
      IRB::ColorPrinter.pp(obj, "".dup, width)
    else
      obj.pretty_inspect
    end
  end
end
            
colored_inspect(obj, width: SESSION.width, no_color: false) click to toggle source
 
               # File debug-1.4.0/lib/debug/color.rb, line 66
def colored_inspect obj, width: SESSION.width, no_color: false
  with_inspection_error_guard do
    if !no_color
      color_pp obj, width
    else
      obj.pretty_inspect
    end
  end
end
            
colorize(str, color) click to toggle source
 
               # File debug-1.4.0/lib/debug/color.rb, line 35
def colorize str, color
  if !CONFIG[:no_color]
    irb_colorize str, color
  else
    str
  end
end
            
colorize_blue(str) click to toggle source
 
               # File debug-1.4.0/lib/debug/color.rb, line 96
def colorize_blue(str)
  colorize(str, [:BLUE, :BOLD])
end
            
colorize_code(code) click to toggle source
 
               # File debug-1.4.0/lib/debug/color.rb, line 78
def colorize_code code
  IRB::Color.colorize_code(code, colorable: true)
end
            
colorize_cyan(str) click to toggle source
 
               # File debug-1.4.0/lib/debug/color.rb, line 92
def colorize_cyan(str)
  colorize(str, [:CYAN, :BOLD])
end
            
colorize_dim(str) click to toggle source
 
               # File debug-1.4.0/lib/debug/color.rb, line 104
def colorize_dim(str)
  colorize(str, [:DIM])
end
            
colorize_magenta(str) click to toggle source
 
               # File debug-1.4.0/lib/debug/color.rb, line 100
def colorize_magenta(str)
  colorize(str, [:MAGENTA, :BOLD])
end
            
irb_colorize(str, color) click to toggle source
 
               # File debug-1.4.0/lib/debug/color.rb, line 26
def irb_colorize str, color
  IRB::Color.colorize str, color, colorable: true
end
            
with_inspection_error_guard() click to toggle source
 
               # File debug-1.4.0/lib/debug/color.rb, line 108
def with_inspection_error_guard
  yield
rescue Exception => ex
  err_msg = "#{ex.inspect} rescued during inspection"
  string_result = obj.to_s rescue nil

  # don't colorize the string here because it's not from user's application
  if string_result
    %Q{"#{string_result}" from #to_s because #{err_msg}}
  else
    err_msg
  end
end
            
There is an updated format of the API docs for this version here.