module Jekyll::Utils::Ansi

Constants

COLORS
ESCAPE
MATCH

Public Instance Methods

has?(str) click to toggle source
# File lib/jekyll/utils/ansi.rb, line 31
def has?(str)
  !!(str =~ MATCH)
end
reset(str = "") click to toggle source

Reset the color back to the default color so that you do not leak any colors when you move onto the next line. This is probably normally used as part of a wrapper so that we don’t leak colors.

# File lib/jekyll/utils/ansi.rb, line 39
def reset(str = "")
  @ansi_reset ||= format("%c[0m", 27)
  "#{@ansi_reset}#{str}"
end
strip(str) click to toggle source

Strip ANSI from the current string. It also strips cursor stuff, well some of it, and it also strips some other stuff that a lot of the other ANSI strippers don’t.

# File lib/jekyll/utils/ansi.rb, line 25
def strip(str)
  str.gsub MATCH, ""
end