Class: Vagrant::UI::Interface
- Inherits:
-
Object
- Object
- Vagrant::UI::Interface
- Defined in:
- lib/vagrant/ui.rb
Overview
Vagrant UIs handle communication with the outside world (typically through a shell). They must respond to the following methods:
info
warn
error
success
Direct Known Subclasses
Instance Attribute Summary collapse
-
#opts ⇒ Object
Opts can be used to set some options.
-
#stderr ⇒ IO
UI error output.
-
#stdin ⇒ IO
UI input.
-
#stdout ⇒ IO
UI output.
Instance Method Summary collapse
- #color? ⇒ false
-
#initialize ⇒ Interface
constructor
A new instance of Interface.
- #initialize_copy(original) ⇒ Object
-
#machine(type, *data) ⇒ Object
For machine-readable output.
Constructor Details
#initialize ⇒ Interface
Returns a new instance of Interface.
33 34 35 36 37 38 39 40 |
# File 'lib/vagrant/ui.rb', line 33 def initialize @logger = Log4r::Logger.new("vagrant::ui::interface") @opts = {} @stdin = $stdin @stdout = $stdout @stderr = $stderr end |
Instance Attribute Details
#opts ⇒ Object
Opts can be used to set some options. These options are implementation specific. See the implementation for more docs.
22 23 24 |
# File 'lib/vagrant/ui.rb', line 22 def opts @opts end |
#stderr ⇒ IO
Returns UI error output. Defaults to $stderr
.
31 32 33 |
# File 'lib/vagrant/ui.rb', line 31 def stderr @stderr end |
#stdin ⇒ IO
Returns UI input. Defaults to $stdin
.
25 26 27 |
# File 'lib/vagrant/ui.rb', line 25 def stdin @stdin end |
#stdout ⇒ IO
Returns UI output. Defaults to $stdout
.
28 29 30 |
# File 'lib/vagrant/ui.rb', line 28 def stdout @stdout end |
Instance Method Details
#color? ⇒ false
67 68 69 |
# File 'lib/vagrant/ui.rb', line 67 def color? return false end |
#initialize_copy(original) ⇒ Object
42 43 44 45 |
# File 'lib/vagrant/ui.rb', line 42 def initialize_copy(original) super @opts = original.opts.dup end |
#machine(type, *data) ⇒ Object
For machine-readable output.
75 76 77 |
# File 'lib/vagrant/ui.rb', line 75 def machine(type, *data) @logger.info("Machine: #{type} #{data.inspect}") end |