module Cucumber::Term::ANSIColor
def attributes
def attributes ATTRIBUTE_NAMES end
def colorize(text, color_code)
def colorize(text, color_code) return String.new(text || '') unless Cucumber::Term::ANSIColor.coloring? return "\e[#{color_code}m" unless text "\e[#{color_code}m#{text}\e[0m" end
def included(klass)
def included(klass) return unless klass == String ATTRIBUTES.delete(:clear) ATTRIBUTE_NAMES.delete(:clear) end
def uncolored(text = nil)
Returns an uncolored version of the string
def uncolored(text = nil) if block_given? uncolorize(yield) elsif text uncolorize(text) elsif respond_to?(:to_str) uncolorize(to_str) else '' end end
def uncolorize(string)
def uncolorize(string) string.gsub(COLORED_REGEXP, '') end