module Nuggets::ANSIColor2CSS

Constants

ATTRIBUTES
ATTRIBUTES_RE
CLEAR
COLOR_RE
DELIMITER
STYLE

Public Instance Methods

clear(attributes) click to toggle source
# File lib/nuggets/ansicolor2css.rb, line 105
def clear(attributes)
  CLEAR if attributes.delete('0')
end
convert(string) click to toggle source
# File lib/nuggets/ansicolor2css.rb, line 97
def convert(string)
  string.gsub(COLOR_RE) { format($1.split(DELIMITER).uniq) }
end
format(attributes) click to toggle source
# File lib/nuggets/ansicolor2css.rb, line 101
def format(attributes)
  "#{clear(attributes)}#{style(attributes) if attributes.any?}"
end
style(attributes) click to toggle source
# File lib/nuggets/ansicolor2css.rb, line 109
def style(attributes)
  STYLE % ATTRIBUTES.values_at(*attributes).join('; ')
end