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 105 def clear(attributes) 106 CLEAR if attributes.delete('0') 107 end
convert(string)
click to toggle source
# File lib/nuggets/ansicolor2css.rb 97 def convert(string) 98 string.gsub(COLOR_RE) { format($1.split(DELIMITER).uniq) } 99 end
format(attributes)
click to toggle source
# File lib/nuggets/ansicolor2css.rb 101 def format(attributes) 102 "#{clear(attributes)}#{style(attributes) if attributes.any?}" 103 end
style(attributes)
click to toggle source
# File lib/nuggets/ansicolor2css.rb 109 def style(attributes) 110 STYLE % ATTRIBUTES.values_at(*attributes).join('; ') 111 end