Class: Vagrant::UI::Interface
- Inherits:
-
Object
- Object
- Vagrant::UI::Interface
- Defined in:
- lib/vagrant/ui.rb,
lib/vagrant/ui/remote.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.
Class Method Summary collapse
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.
-
#rewriting {|_self| ... } ⇒ Object
Yields self (UI) Provides a way for selectively displaying or not displaying updating content like download progress.
- #to_proto ⇒ Object
Constructor Details
#initialize ⇒ Interface
Returns a new instance of Interface.
37 38 39 40 41 42 43 44 |
# File 'lib/vagrant/ui.rb', line 37 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.
26 27 28 |
# File 'lib/vagrant/ui.rb', line 26 def opts @opts end |
#stderr ⇒ IO
Returns UI error output. Defaults to $stderr
.
35 36 37 |
# File 'lib/vagrant/ui.rb', line 35 def stderr @stderr end |
#stdin ⇒ IO
Returns UI input. Defaults to $stdin
.
29 30 31 |
# File 'lib/vagrant/ui.rb', line 29 def stdin @stdin end |
#stdout ⇒ IO
Returns UI output. Defaults to $stdout
.
32 33 34 |
# File 'lib/vagrant/ui.rb', line 32 def stdout @stdout end |
Class Method Details
.inherited(klass) ⇒ Object
15 16 17 |
# File 'lib/vagrant/ui/remote.rb', line 15 def self.inherited(klass) klass.prepend(Reformatter) end |
Instance Method Details
#color? ⇒ false
71 72 73 |
# File 'lib/vagrant/ui.rb', line 71 def color? return false end |
#initialize_copy(original) ⇒ Object
46 47 48 49 |
# File 'lib/vagrant/ui.rb', line 46 def initialize_copy(original) super @opts = original.opts.dup end |
#machine(type, *data) ⇒ Object
For machine-readable output.
79 80 81 |
# File 'lib/vagrant/ui.rb', line 79 def machine(type, *data) @logger.info("Machine: #{type} #{data.inspect}") end |
#rewriting {|_self| ... } ⇒ Object
Yields self (UI) Provides a way for selectively displaying or not displaying updating content like download progress.
86 87 88 |
# File 'lib/vagrant/ui.rb', line 86 def rewriting yield self end |
#to_proto ⇒ Object
90 91 92 93 |
# File 'lib/vagrant/ui.rb', line 90 def to_proto raise NotImplementedError, "Vagrant::UI::Interface#to_proto" end |