Module: Test::Unit::Assertions::Coulor
- Included in:
- RubyReflector
- Defined in:
- lib/assert2.rb
Overview
:nodoc:
Constant Summary collapse
- BOLD =
"\e[1m"
- CLEAR =
"\e[0m"
Instance Method Summary collapse
- #blue(text) ⇒ Object
- #bold(text) ⇒ Object
-
#colorize(we_color) ⇒ Object
TODO shell into term-ansicolor!.
-
#colorize? ⇒ Boolean
ERGO how other libraries set these options transparent??.
-
#colour(text, colour_code) ⇒ Object
ERGO modularize these; anneal with Win32.
- #green(text) ⇒ Object
- #magenta(text) ⇒ Object
- #orange(text) ⇒ Object
- #red(text) ⇒ Object
Instance Method Details
#blue(text) ⇒ Object
108 |
# File 'lib/assert2.rb', line 108 def blue(text); colour(text, "\e[34m"); end |
#bold(text) ⇒ Object
101 102 103 104 |
# File 'lib/assert2.rb', line 101 def bold(text) return BOLD + text + CLEAR if colorize? return text end |
#colorize(we_color) ⇒ Object
TODO shell into term-ansicolor!
85 86 87 |
# File 'lib/assert2.rb', line 85 def colorize(we_color) @@we_color = we_color end |
#colorize? ⇒ Boolean
ERGO how other libraries set these options transparent??
96 97 98 99 100 |
# File 'lib/assert2.rb', line 96 def colorize? # ERGO how other libraries set these options transparent?? we_color = (@@we_color rescue true) # ERGO parens needed? return false if ENV['EMACS'] == 't' return (we_color == :always or we_color && $stdout.tty?) end |
#colour(text, colour_code) ⇒ Object
ERGO modularize these; anneal with Win32
92 93 94 95 |
# File 'lib/assert2.rb', line 92 def colour(text, colour_code) return colour_code + text + CLEAR if colorize? return text end |
#green(text) ⇒ Object
105 |
# File 'lib/assert2.rb', line 105 def green(text); colour(text, "\e[32m"); end |
#magenta(text) ⇒ Object
107 |
# File 'lib/assert2.rb', line 107 def magenta(text); colour(text, "\e[35m"); end |
#orange(text) ⇒ Object
109 |
# File 'lib/assert2.rb', line 109 def orange(text); colour(text, "\e[3Bm"); end |
#red(text) ⇒ Object
106 |
# File 'lib/assert2.rb', line 106 def red(text); colour(text, "\e[31m"); end |