Class: Aruba::Platforms::WindowsCommandString

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
lib/aruba/platforms/windows_command_string.rb

Overview

This is a command which should be run

This adds cmd.exec in front of commmand

Instance Method Summary collapse

Constructor Details

#initialize(cmd) ⇒ WindowsCommandString

Returns a new instance of WindowsCommandString.



13
14
15
# File 'lib/aruba/platforms/windows_command_string.rb', line 13

def initialize(cmd)
  __setobj__ format('%s /c "%s"', Aruba.platform.which('cmd.exe'), cmd)
end

Instance Method Details

#to_aObject

Convert to array



18
19
20
21
# File 'lib/aruba/platforms/windows_command_string.rb', line 18

def to_a
  Shellwords.split( __getobj__.gsub('\\', 'ARUBA_TMP_PATHSEPARATOR') ).
    map { |w| w.gsub('ARUBA_TMP_PATHSEPARATOR', '\\') }
end

#to_sObject Also known as: inspect



24
25
26
# File 'lib/aruba/platforms/windows_command_string.rb', line 24

def to_s
  __getobj__.to_s
end