Class: ChefCLI::UI
- Inherits:
-
Object
- Object
- ChefCLI::UI
- Defined in:
- lib/chef-cli/ui.rb
Defined Under Namespace
Classes: NullStream
Instance Attribute Summary collapse
-
#err_stream ⇒ Object
readonly
Returns the value of attribute err_stream.
-
#out_stream ⇒ Object
readonly
Returns the value of attribute out_stream.
Class Method Summary collapse
Instance Method Summary collapse
- #err(message) ⇒ Object
-
#initialize(out: nil, err: nil) ⇒ UI
constructor
A new instance of UI.
- #msg(message) ⇒ Object
- #print(message) ⇒ Object
Constructor Details
#initialize(out: nil, err: nil) ⇒ UI
Returns a new instance of UI.
40 41 42 43 |
# File 'lib/chef-cli/ui.rb', line 40 def initialize(out: nil, err: nil) @out_stream = out || $stdout @err_stream = err || $stderr end |
Instance Attribute Details
#err_stream ⇒ Object (readonly)
Returns the value of attribute err_stream.
38 39 40 |
# File 'lib/chef-cli/ui.rb', line 38 def err_stream @err_stream end |
#out_stream ⇒ Object (readonly)
Returns the value of attribute out_stream.
37 38 39 |
# File 'lib/chef-cli/ui.rb', line 37 def out_stream @out_stream end |
Class Method Details
.null ⇒ Object
33 34 35 |
# File 'lib/chef-cli/ui.rb', line 33 def self.null new(out: NullStream.new, err: NullStream.new) end |
Instance Method Details
#err(message) ⇒ Object
45 46 47 |
# File 'lib/chef-cli/ui.rb', line 45 def err() @err_stream.puts() end |
#msg(message) ⇒ Object
49 50 51 |
# File 'lib/chef-cli/ui.rb', line 49 def msg() @out_stream.puts() end |
#print(message) ⇒ Object
53 54 55 |
# File 'lib/chef-cli/ui.rb', line 53 def print() @out_stream.print() end |