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 Attribute Summary collapse
-
#err ⇒ Object
readonly
Returns the value of attribute err.
-
#out ⇒ Object
readonly
Returns the value of attribute out.
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.
68 69 70 |
# File 'lib/chef/formatters/base.rb', line 68 def initialize(out, err) @out, @err = out, err end |
Instance Attribute Details
#err ⇒ Object (readonly)
Returns the value of attribute err.
66 67 68 |
# File 'lib/chef/formatters/base.rb', line 66 def err @err end |
#out ⇒ Object (readonly)
Returns the value of attribute out.
65 66 67 |
# File 'lib/chef/formatters/base.rb', line 65 def out @out end |
Instance Method Details
#color(string, *colors) ⇒ Object Also known as: print
79 80 81 82 83 84 85 |
# File 'lib/chef/formatters/base.rb', line 79 def color(string, *colors) if Chef::Config[:color] @out.print highline.color(string, *colors) else @out.print string end end |
#highline ⇒ Object
72 73 74 75 76 77 |
# File 'lib/chef/formatters/base.rb', line 72 def highline @highline ||= begin require 'highline' HighLine.new end end |