class Vagrant::UI::Remote
Attributes
client[R]
Public Class Methods
new(client)
click to toggle source
Calls superclass method
Vagrant::UI::Basic::new
# File lib/vagrant/ui/remote.rb, line 20 def initialize(client) super() @client = client @logger = Log4r::Logger.new("vagrant::ui") end
Public Instance Methods
ask(message, **opts)
click to toggle source
# File lib/vagrant/ui/remote.rb, line 30 def ask(message, **opts) opts[:style] ||= :detail opts[:echo] = true if !opts.key?(:echo) @client.input(message.gsub("%", "%%"), **opts) end
clear_line()
click to toggle source
# File lib/vagrant/ui/remote.rb, line 26 def clear_line @client.clear_line end
machine(type, *data)
click to toggle source
# File lib/vagrant/ui/remote.rb, line 48 def machine(type, *data) if !client.is_machine_readable @logger.info("Machine: #{type} #{data.inspect}") return end opts = {} opts = data.pop if data.last.kind_of?(Hash) target = opts[:target] || "" # Prepare the data by replacing characters that aren't outputted data.each_index do |i| data[i] = data[i].to_s.dup data[i].gsub!(",", "%!(VAGRANT_COMMA)") data[i].gsub!("\n", "\\n") data[i].gsub!("\r", "\\r") end table_data = { rows: [[Time.now.utc.to_i, target, type, data.join(",")]] } client.table(table_data, **opts) end
safe_puts(message, **opts)
click to toggle source
# File lib/vagrant/ui/remote.rb, line 36 def safe_puts(message, **opts) message, extra_opts = message opts = { new_line: opts[:printer] == :puts, style: extra_opts[:style], bold: extra_opts[:bold], color: extra_opts[:color] } client.output(message.gsub("%", "%%"), **opts) end
to_proto()
click to toggle source
# File lib/vagrant/ui/remote.rb, line 72 def to_proto @client.proto end