The prefix for `output` messages.
# File lib/vagrant/ui.rb, line 233 def initialize(ui, prefix) super() @prefix = prefix @ui = ui end
# File lib/vagrant/ui.rb, line 283 def format_message(type, message, **opts) opts = self.opts.merge(opts) prefix = "" if !opts.has_key?(:prefix) || opts[:prefix] prefix = OUTPUT_PREFIX prefix = " " * OUTPUT_PREFIX.length if type == :detail || type == :ask || opts[:prefix_spaces] end # Fast-path if there is no prefix return message if prefix.empty? # Otherwise, make sure to prefix every line properly message.split("\n").map do |line| "#{prefix}#{@prefix}: #{line}" end.join("\n") end
# File lib/vagrant/ui.rb, line 240 def initialize_copy(original) super @ui = original.instance_variable_get(:@ui).dup end
For machine-readable output, set the prefix in the options hash and continue it on.
# File lib/vagrant/ui.rb, line 268 def machine(type, *data) opts = {} opts = data.pop if data.last.is_a?(Hash) opts[:target] = @prefix data << opts @ui.machine(type, *data) end
Return the parent's opts.
@return [Hash]
# File lib/vagrant/ui.rb, line 279 def opts @ui.opts end