Module: Assert::View::Helpers::AnsiStyles
- Defined in:
- lib/assert/view/helpers/ansi.rb
Instance Method Summary collapse
- #ansi_style(*ansi_codes) ⇒ Object
- #ansi_styled_msg(msg, styles = []) ⇒ Object
- #result_ansi_styles(result) ⇒ Object
Instance Method Details
#ansi_style(*ansi_codes) ⇒ Object
19 20 21 |
# File 'lib/assert/view/helpers/ansi.rb', line 19 def ansi_style(*ansi_codes) ansi_codes.collect{|code| ANSI.send(code) rescue nil}.compact.join('') end |
#ansi_styled_msg(msg, styles = []) ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/assert/view/helpers/ansi.rb', line 11 def ansi_styled_msg(msg, styles=[]) if !(style = ansi_style(*styles)).empty? style + msg + ANSI.send(:reset) else msg end end |
#result_ansi_styles(result) ⇒ Object
7 8 9 |
# File 'lib/assert/view/helpers/ansi.rb', line 7 def result_ansi_styles(result) view..styled ? view..send("#{result.to_sym}_styles") : [] end |