Module: TestLab::DualMethods
Overview
Test Lab Class Methods
These are special methods that we both include and extend on the parent class.
Instance Method Summary collapse
-
#build_command_line(name, *args) ⇒ String
Build Command Line.
-
#gem_dir ⇒ String
Test Lab Gem Directory.
-
#hostname ⇒ String
TestLab Hostname.
-
#ui ⇒ ZTK::UI
Get Test Lab User Interface.
-
#ui=(value) ⇒ ZTK::UI
Set Test Lab User Interface.
Instance Method Details
#build_command_line(name, *args) ⇒ String
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.
533 534 535 536 |
# 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 ⇒ String
Test Lab Gem Directory
Returns the directory path to where the gem is installed.
520 521 522 523 |
# File 'lib/testlab.rb', line 520 def gem_dir directory = File.join(File.dirname(__FILE__), "..") File.(directory, File.dirname(__FILE__)) end |
#hostname ⇒ String
TestLab Hostname
Gets the hostname portion of the fqdn for the current host.
511 512 513 |
# File 'lib/testlab.rb', line 511 def hostname Socket.gethostname.split('.').first.strip end |
#ui ⇒ ZTK::UI
Get Test Lab User Interface
Returns the instance of ZTK:UI the lab is using for its user interface.
489 490 491 |
# File 'lib/testlab.rb', line 489 def ui @@ui ||= ZTK::UI.new end |
#ui=(value) ⇒ ZTK::UI
Set Test Lab User Interface
Sets the instance of ZTK::UI the lab will use for its user interface.
501 502 503 504 |
# File 'lib/testlab.rb', line 501 def ui=(value) @@ui = value value end |