class Vixen::CommandLine::Base

Attributes

context[R]
start[R]

Public Class Methods

new(context) click to toggle source
# File lib/vixen/command_line/base.rb, line 4
def initialize(context)
  @start = Time.now
  @context = context
end

Public Instance Methods

elapsed_time() click to toggle source
# File lib/vixen/command_line/base.rb, line 9
def elapsed_time
  "[%s]" % (Time.at(Time.now - start).utc.strftime '%T')
end
host() click to toggle source
# File lib/vixen/command_line/base.rb, line 29
def host
  return @host unless @host.nil?
  @host = context[:host] || Vixen.local_connect
end
new_line_after() { || ... } click to toggle source
# File lib/vixen/command_line/base.rb, line 13
def new_line_after
  val = yield if block_given?
  $stdout.puts
  val
end
print(message, *args) click to toggle source
puts(message, *args) click to toggle source
# File lib/vixen/command_line/base.rb, line 25
def puts(message, *args)
  new_line_after { print(message, args) }
end
vms() click to toggle source
# File lib/vixen/command_line/base.rb, line 34
def vms
  return @vms unless @vms.nil?
  context[:vms] ||= host.running_vms
  @vms = context[:vms]
end