Class: Uttk::PathFilters::ColorStatus
- Inherits:
-
PathFilter
- Object
- Logger::Backend
- Filters::Filter
- PathFilter
- Uttk::PathFilters::ColorStatus
- Includes:
- Concrete
- Defined in:
- lib/uttk/path_filters/ColorStatus.rb
Constant Summary collapse
- STYLE =
{ :PASS => [:green], :FAIL => [:red], :ABORT => [:magenta], :SKIP => [:yellow], :ERROR => [:bold, :red] }
Instance Method Summary collapse
- #color(str) ⇒ Object
- #filter(path, leaf) ⇒ Object
-
#initialize(*a, &b) ⇒ ColorStatus
constructor
A new instance of ColorStatus.
Methods inherited from PathFilter
Methods inherited from Filters::Filter
Methods inherited from Logger::Backend
Constructor Details
#initialize(*a, &b) ⇒ ColorStatus
Returns a new instance of ColorStatus.
22 23 24 25 26 |
# 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 |
Instance Method Details
#color(str) ⇒ Object
38 39 40 41 42 43 44 |
# 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 |