module DEBUGGER__::Color

Constants

SUPPORT_COLORABLE_OPTION

Public Instance Methods

color_pp(obj, width) click to toggle source
# File debug-1.9.2/lib/debug/color.rb, line 50
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.9.2/lib/debug/color.rb, line 67
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.9.2/lib/debug/color.rb, line 36
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.9.2/lib/debug/color.rb, line 97
def colorize_blue(str)
  colorize(str, [:BLUE, :BOLD])
end
colorize_code(code) click to toggle source
# File debug-1.9.2/lib/debug/color.rb, line 79
def colorize_code code
  IRB::Color.colorize_code(code, colorable: true)
end
colorize_cyan(str) click to toggle source
# File debug-1.9.2/lib/debug/color.rb, line 93
def colorize_cyan(str)
  colorize(str, [:CYAN, :BOLD])
end
colorize_dim(str) click to toggle source
# File debug-1.9.2/lib/debug/color.rb, line 105
def colorize_dim(str)
  colorize(str, [:DIM])
end
colorize_magenta(str) click to toggle source
# File debug-1.9.2/lib/debug/color.rb, line 101
def colorize_magenta(str)
  colorize(str, [:MAGENTA, :BOLD])
end
irb_colorize(str, color) click to toggle source
# File debug-1.9.2/lib/debug/color.rb, line 27
def irb_colorize str, color
  IRB::Color.colorize str, color, colorable: true
end
with_inspection_error_guard() { || ... } click to toggle source
# File debug-1.9.2/lib/debug/color.rb, line 109
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