Module: Cardio::Utils::Ansi2Html

Defined in:
lib/cardio/utils/ansi2_html.rb

Overview

convert ANSI to html

Instance Method Summary collapse

Instance Method Details

#ansi2html(data) ⇒ Object



6
7
8
9
10
# File 'lib/cardio/utils/ansi2_html.rb', line 6

def ansi2html data
  data.gsub(/\033\[(?<code>[\d\;]{2,})m(?<content>.*?)\033\[0m/) do
    to_span_tag Regexp.last_match(:code), Regexp.last_match(:content)
  end
end