Module: GreenPepper::KeywordFormat
- Included in:
- AskSuccess, CheckFailure, CheckSuccess, FreeTextWriter, KeywordError, ThenResults
- Defined in:
- lib/greenpepper/writer/freetextresult.rb
Instance Method Summary collapse
- #error(error) ⇒ Object
- #green_highlight(text) ⇒ Object
- #grey_highlight(text) ⇒ Object
- #highlight(color, text) ⇒ Object
- #indent(text) ⇒ Object
- #indent2(text) ⇒ Object
- #newline(text) ⇒ Object
- #red_highlight(text) ⇒ Object
- #yellow_highlight(text) ⇒ Object
Instance Method Details
#error(error) ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/greenpepper/writer/freetextresult.rb', line 45 def error(error) res = indent yellow_highlight("#{error.class}: " + "#{CGI::escapeHTML error.to_s}") if error.backtrace res += '<hr/>' error.backtrace.each { |step| res << indent2(yellow_highlight(CGI::escapeHTML(step))) } end res end |
#green_highlight(text) ⇒ Object
33 34 35 |
# File 'lib/greenpepper/writer/freetextresult.rb', line 33 def green_highlight(text) highlight(Html::GREEN, text) end |
#grey_highlight(text) ⇒ Object
41 42 43 |
# File 'lib/greenpepper/writer/freetextresult.rb', line 41 def grey_highlight(text) highlight(Html::GREY, text) end |
#highlight(color, text) ⇒ Object
25 26 27 |
# File 'lib/greenpepper/writer/freetextresult.rb', line 25 def highlight(color, text) "<font style=\"background-color: #{color};\">#{text}</font>" end |
#indent(text) ⇒ Object
13 14 15 |
# File 'lib/greenpepper/writer/freetextresult.rb', line 13 def indent(text) "<div class=\"greenpepper-freetext-indent\">#{text}</div>" end |
#indent2(text) ⇒ Object
17 18 19 |
# File 'lib/greenpepper/writer/freetextresult.rb', line 17 def indent2(text) "<div class=\"greenpepper-freetext-indent2\">#{text}</div>" end |
#newline(text) ⇒ Object
21 22 23 |
# File 'lib/greenpepper/writer/freetextresult.rb', line 21 def newline(text) "<div class=\"greenpepper-freetext\">#{text}</div>" end |