Class: Kitchen::LoginCommand

Inherits:
Object
  • Object
show all
Defined in:
lib/kitchen/login_command.rb

Overview

Value object to track a shell command that will be passed to Kernel.exec for execution.

Author:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(command, arguments, options = {}) ⇒ LoginCommand

Constructs a new LoginCommand instance.

Parameters:

  • command (String)

    command

  • arguments (Array)

    array of arguments to the command

  • options (Hash) (defaults to: {})

    options hash, passed to ‘Kernel#exec`

See Also:



39
40
41
42
43
# File 'lib/kitchen/login_command.rb', line 39

def initialize(command, arguments, options = {})
  @command = command
  @arguments = Array(arguments)
  @options = options
end

Instance Attribute Details

#argumentsArray (readonly)

Returns array of arguments to the command.

Returns:

  • (Array)

    array of arguments to the command



28
29
30
# File 'lib/kitchen/login_command.rb', line 28

def arguments
  @arguments
end

#commandString (readonly)

Returns login command.

Returns:

  • (String)

    login command



25
26
27
# File 'lib/kitchen/login_command.rb', line 25

def command
  @command
end

#optionsHash (readonly)

Returns options hash, passed to ‘Kernel#exec`.

Returns:

  • (Hash)

    options hash, passed to ‘Kernel#exec`



31
32
33
# File 'lib/kitchen/login_command.rb', line 31

def options
  @options
end

Instance Method Details

#exec_argsObject



45
46
47
# File 'lib/kitchen/login_command.rb', line 45

def exec_args
  [command, *arguments, options]
end