Class: Chef::Formatters::Outputter
- Defined in:
- lib/chef/formatters/base.rb
Overview
Outputter
Handles basic printing tasks like colorizing. – TODO: Duplicates functionality from knife, upfactor.
Instance Method Summary collapse
- #color(string, *colors) ⇒ Object (also: #print)
- #highline ⇒ Object
-
#initialize(out, err) ⇒ Outputter
constructor
A new instance of Outputter.
- #puts(string, *colors) ⇒ Object
Constructor Details
#initialize(out, err) ⇒ Outputter
Returns a new instance of Outputter.
65 66 67 |
# File 'lib/chef/formatters/base.rb', line 65 def initialize(out, err) @out, @err = out, err end |
Instance Method Details
#color(string, *colors) ⇒ Object Also known as: print
76 77 78 79 80 81 82 |
# File 'lib/chef/formatters/base.rb', line 76 def color(string, *colors) if Chef::Config[:color] @out.print highline.color(string, *colors) else @out.print string end end |
#highline ⇒ Object
69 70 71 72 73 74 |
# File 'lib/chef/formatters/base.rb', line 69 def highline @highline ||= begin require 'highline' HighLine.new end end |