module TestLab::DualMethods

Test Lab Class Methods

These are special methods that we both include and extend on the parent class.

Public Instance Methods

build_command_line(name, *args) click to toggle source

Build Command Line

Attempts to build a command line to a binary for us. We use ZTK::Locator to attempt to determine if we are using bundler binstubs; otherwise we simply rely on /bin/env to find the executable for us via the PATH environment variable.

@return [String] Constructed command line with arguments.

# File lib/testlab.rb, line 533
def build_command_line(name, *args)
  executable = (ZTK::Locator.find('bin', name) rescue "/usr/bin/env #{name}")
  [executable, args].flatten.compact.join(' ')
end
gem_dir() click to toggle source

Test Lab Gem Directory

Returns the directory path to where the gem is installed.

@return [String] The directory path to the gem installation.

# File lib/testlab.rb, line 520
def gem_dir
  directory = File.join(File.dirname(__FILE__), "..")
  File.expand_path(directory, File.dirname(__FILE__))
end
hostname() click to toggle source

TestLab Hostname

Gets the hostname portion of the fqdn for the current host.

@return [String] The hostname for the current host.

# File lib/testlab.rb, line 511
def hostname
  Socket.gethostname.split('.').first.strip
end
ui() click to toggle source

Get Test Lab User Interface

Returns the instance of ZTK:UI the lab is using for its user interface.

@return [ZTK::UI] Our user interface instance of ZTK::UI.

# File lib/testlab.rb, line 489
def ui
  @@ui ||= ZTK::UI.new
end
ui=(value) click to toggle source

Set Test Lab User Interface

Sets the instance of ZTK::UI the lab will use for its user interface.

@param [ZTK:UI] value The instance of ZTK::UI to use for the labs user

interface.

@return [ZTK::UI]

# File lib/testlab.rb, line 501
def ui=(value)
  @@ui = value
  value
end