Class Uttk::PathFilters::ColorStatus
In: lib/uttk/path_filters/ColorStatus.rb
Parent: PathFilter

Methods

color   filter   new  

Included Modules

Concrete

Constants

STYLE = { :PASS => [:green], :FAIL => [:red], :ABORT => [:magenta], :SKIP => [:yellow], :ERROR => [:bold, :red]

Public Class methods

[Source]

# File lib/uttk/path_filters/ColorStatus.rb, line 22
      def initialize ( *a, &b )
        raise "HighLine is unavailable" unless defined? HighLine
        @h = HighLine.new
        super
      end

Public Instance methods

[Source]

# File lib/uttk/path_filters/ColorStatus.rb, line 38
      def color ( str )
        if str =~ /^([A-Z]+)(\(.*\))?$/
          node = StyledString.new(@h.color(str, *STYLE[$1.to_sym]).to_s)
        else
          str
        end
      end

[Source]

# File lib/uttk/path_filters/ColorStatus.rb, line 46
      def filter ( path, leaf )
        if (leaf.is_a? Symbol or leaf.is_a? String) and not leaf.to_s.empty?
          leaf = color(leaf.to_s)
        end
        [path, leaf]
      end

[Validate]