Class: Synco::Shell

Inherits:
Object
  • Object
show all
Defined in:
lib/synco/shell.rb

Overview

A shell provides access to a server, typically to run commands.

Direct Known Subclasses

Synco::Shells::SSH

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*command, arguments: [], **options) ⇒ Shell

Returns a new instance of Shell.



26
27
28
29
30
31
# File 'lib/synco/shell.rb', line 26

def initialize(*command, arguments: [], **options)
	@command = command.empty? ? default_command : command
	
	@arguments = arguments
	@options = options
end

Instance Attribute Details

#argumentsObject (readonly)

Returns the value of attribute arguments.



33
34
35
# File 'lib/synco/shell.rb', line 33

def arguments
  @arguments
end

Instance Method Details

#connection_command(server, *arguments) ⇒ Object

The command required to connect to the remote machine.



36
37
38
# File 'lib/synco/shell.rb', line 36

def connection_command(server, *arguments)
	[*@command, *@arguments, *arguments, server.host]
end

#to_sObject



40
41
42
# File 'lib/synco/shell.rb', line 40

def to_s
	"<#{self.class} #{@command} #{@options.inspect}>"
end