class QemuToolkit::Config

A configuration class that acts as a singleton, but really isn’t. This allows for a mixed style of coding, either using QemuToolkit::Config as an instance or as a class.

Attributes

etc[W]
var_run[W]

Public Class Methods

current() click to toggle source
# File lib/qemu-toolkit/config.rb, line 17
def current
  @current ||= new
end
method_missing(sym, *args, &block) click to toggle source
Calls superclass method
# File lib/qemu-toolkit/config.rb, line 9
def method_missing(sym, *args, &block)
  return current.send(sym, *args, &block) if current.respond_to?(sym)
  super
end
reset() click to toggle source
# File lib/qemu-toolkit/config.rb, line 20
def reset 
  @current = nil
end
respond_to?(sym) click to toggle source
Calls superclass method
# File lib/qemu-toolkit/config.rb, line 13
def respond_to?(sym)
  current.respond_to?(sym) || super
end

Public Instance Methods

backend() click to toggle source

The command runner backend for all commands. Actual execution happens through this instance. This has advantages for testing and for customizing behaviour.

# File lib/qemu-toolkit/config.rb, line 39
def backend
  @backend ||= Backend::Illumos.new
end
etc(*args) click to toggle source
# File lib/qemu-toolkit/config.rb, line 28
def etc(*args)
  expand_path(@etc, *args)
end
var_run(*args) click to toggle source
# File lib/qemu-toolkit/config.rb, line 31
def var_run(*args)
  expand_path(@var_run, *args)
end

Private Instance Methods

expand_path(*args) click to toggle source
# File lib/qemu-toolkit/config.rb, line 43
def expand_path(*args)
  File.expand_path(
    File.join(*args))
end