Class: Synco::Shell
- Inherits:
-
Object
- Object
- Synco::Shell
- Defined in:
- lib/synco/shell.rb
Overview
A shell provides access to a server, typically to run commands.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#arguments ⇒ Object
readonly
Returns the value of attribute arguments.
Instance Method Summary collapse
-
#connection_command(server, *arguments) ⇒ Object
The command required to connect to the remote machine.
-
#initialize(*command, arguments: [], **options) ⇒ Shell
constructor
A new instance of Shell.
- #to_s ⇒ Object
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: [], **) @command = command.empty? ? default_command : command @arguments = arguments @options = end |
Instance Attribute Details
#arguments ⇒ Object (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_s ⇒ Object
40 41 42 |
# File 'lib/synco/shell.rb', line 40 def to_s "<#{self.class} #{@command} #{@options.inspect}>" end |