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.



11
12
13
14
15
16
# File 'lib/synco/shell.rb', line 11

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.



18
19
20
# File 'lib/synco/shell.rb', line 18

def arguments
  @arguments
end

Instance Method Details

#connection_command(server, *arguments) ⇒ Object

The command required to connect to the remote machine.



21
22
23
# File 'lib/synco/shell.rb', line 21

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

#to_sObject



25
26
27
# File 'lib/synco/shell.rb', line 25

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