class Object

Constants

AnsiColor

Public Instance Methods

_ansi2html() click to toggle source
# File lib/dom.rb, line 36
def _ansi2html
        sc = StringScanner.new(self)
        io = StringIO.new
        io.print(
                if sc.scan(/\e\[0?m/o) then '</span>'
                elsif sc.scan(/\e\[0?(\d+)m/o) then '<span class="%s">' % AnsiColor[sc[1]]
                end ||
        sc.scan(/./mo)) until sc.eos?
        io.string
end
dom_escape(tag = nil) click to toggle source
# File lib/dom.rb, line 33
def dom_escape tag = nil
        case tag; when :style, :script then self else Dom::Coder.encode(self) end
end