Class: SSHake::BaseSession
- Inherits:
-
Object
- Object
- SSHake::BaseSession
- Defined in:
- lib/sshake/base_session.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#id ⇒ String
readonly
An ID for this session.
-
#klogger ⇒ Klogger?
A logger for this session.
-
#raise_on_error ⇒ Boolean
Specify the default behaviour for raising erors.
Instance Method Summary collapse
-
#connect ⇒ void
Connect to the SSH server.
-
#connected? ⇒ Boolean
Is there an established SSH connection.
-
#disconnect ⇒ void
Disconnect the underlying SSH connection.
-
#execute(_commands, _options = nil) ⇒ Object
Execute a command.
-
#initialize(*_args, klogger: nil, **_options) ⇒ BaseSession
constructor
A new instance of BaseSession.
-
#kill! ⇒ Object
Kill the underlying connection.
- #write_data(_path, _data, _options = nil) ⇒ Object
Constructor Details
#initialize(*_args, klogger: nil, **_options) ⇒ BaseSession
Returns a new instance of BaseSession.
26 27 28 29 |
# File 'lib/sshake/base_session.rb', line 26 def initialize(*_args, klogger: nil, **) @id = SecureRandom.hex(4) @klogger = klogger || SSHake.klogger end |
Instance Attribute Details
#id ⇒ String (readonly)
An ID for this session
19 20 21 |
# File 'lib/sshake/base_session.rb', line 19 def id @id end |
#klogger ⇒ Klogger?
A logger for this session
14 15 16 |
# File 'lib/sshake/base_session.rb', line 14 def klogger @klogger end |
#raise_on_error ⇒ Boolean
Specify the default behaviour for raising erors
24 25 26 |
# File 'lib/sshake/base_session.rb', line 24 def raise_on_error @raise_on_error end |
Instance Method Details
#connect ⇒ void
This method returns an undefined value.
Connect to the SSH server
34 35 36 |
# File 'lib/sshake/base_session.rb', line 34 def connect raise 'Override #connect in sub-sessions' end |
#connected? ⇒ Boolean
Is there an established SSH connection
41 42 43 |
# File 'lib/sshake/base_session.rb', line 41 def connected? raise 'Override #connected? in sub-sessions' end |
#disconnect ⇒ void
This method returns an undefined value.
Disconnect the underlying SSH connection
48 49 50 |
# File 'lib/sshake/base_session.rb', line 48 def disconnect raise 'Override #disconnect in sub-sessions' end |
#execute(_commands, _options = nil) ⇒ Object
Execute a command
59 60 61 |
# File 'lib/sshake/base_session.rb', line 59 def execute(_commands, = nil) raise 'Override #execute in sub-sessions' end |
#kill! ⇒ Object
Kill the underlying connection
53 54 55 |
# File 'lib/sshake/base_session.rb', line 53 def kill! raise 'Override #kill! in sub-sessions' end |
#write_data(_path, _data, _options = nil) ⇒ Object
63 64 65 |
# File 'lib/sshake/base_session.rb', line 63 def write_data(_path, _data, = nil) raise 'Override #write_data in sub-sessions' end |