Class: Recog::Formatter
- Inherits:
-
Object
- Object
- Recog::Formatter
- Defined in:
- lib/recog/formatter.rb
Constant Summary collapse
- COLORS =
{ :red => 31, :yellow => 33, :green => 32, :white => 15 }
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#output ⇒ Object
readonly
Returns the value of attribute output.
Instance Method Summary collapse
- #failure_message(text) ⇒ Object
-
#initialize(options, output) ⇒ Formatter
constructor
A new instance of Formatter.
- #status_message(text) ⇒ Object
- #success_message(text) ⇒ Object
- #warning_message(text) ⇒ Object
Constructor Details
#initialize(options, output) ⇒ Formatter
Returns a new instance of Formatter.
12 13 14 15 |
# File 'lib/recog/formatter.rb', line 12 def initialize(, output) @options = @output = output || StringIO.new end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
10 11 12 |
# File 'lib/recog/formatter.rb', line 10 def @options end |
#output ⇒ Object (readonly)
Returns the value of attribute output.
10 11 12 |
# File 'lib/recog/formatter.rb', line 10 def output @output end |
Instance Method Details
#failure_message(text) ⇒ Object
29 30 31 |
# File 'lib/recog/formatter.rb', line 29 def (text) output.puts color(text, :red) end |
#status_message(text) ⇒ Object
17 18 19 |
# File 'lib/recog/formatter.rb', line 17 def (text) output.puts color(text, :white) end |
#success_message(text) ⇒ Object
21 22 23 |
# File 'lib/recog/formatter.rb', line 21 def (text) output.puts color(text, :green) end |
#warning_message(text) ⇒ Object
25 26 27 |
# File 'lib/recog/formatter.rb', line 25 def (text) output.puts color(text, :yellow) end |