Module: Text::Highlightable
Overview
An object that can be highlighted. This is used by the String class.
Constant Summary collapse
- @@highlighter =
The highlighter for the class in which this module is included.
NonHighlighter.new
Instance Method Summary collapse
-
#highlighter=(hl) ⇒ Object
Sets the highlighter for this class.
Instance Method Details
#highlighter=(hl) ⇒ Object
Sets the highlighter for this class. This can be either by type or by String.
270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 |
# File 'lib/wad/vendor/highlight.rb', line 270 def highlighter=(hl) $VERBOSE = false @@highlighter = case hl when Text::Highlighter hl when Text::Highlighter::NONE, "NONE", nil Text::NonHighlighter.new unless @@highlighter.kind_of?(Text::NonHighlighter) when Text::Highlighter::HTML, "HTML" Text::HTMLHighlighter.new unless @@highlighter.kind_of?(Text::HTMLHighlighter) when Text::Highlighter::ANSI, "ANSI" Text::ANSIHighlighter.new unless @@highlighter.kind_of?(Text::ANSIHighlighter) else Text::NonHighlighter.new end end |