Class: Ridley::SSH::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/ridley/ssh/response.rb

Overview

Author:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(host, options = {}) ⇒ Response

Returns a new instance of Response


12
13
14
15
16
17
18
# File 'lib/ridley/ssh/response.rb', line 12

def initialize(host, options = {})
  @host        = host
  @stdout      = options[:stdout] || String.new
  @stderr      = options[:stderr] || String.new
  @exit_code   = options[:exit_code] || -1
  @exit_signal = options[:exit_signal] || nil
end

Instance Attribute Details

#exit_codeObject

Returns the value of attribute exit_code


9
10
11
# File 'lib/ridley/ssh/response.rb', line 9

def exit_code
  @exit_code
end

#exit_signalObject

Returns the value of attribute exit_signal


10
11
12
# File 'lib/ridley/ssh/response.rb', line 10

def exit_signal
  @exit_signal
end

#hostObject (readonly)

Returns the value of attribute host


5
6
7
# File 'lib/ridley/ssh/response.rb', line 5

def host
  @host
end

#stderrObject

Returns the value of attribute stderr


8
9
10
# File 'lib/ridley/ssh/response.rb', line 8

def stderr
  @stderr
end

#stdoutObject

Returns the value of attribute stdout


7
8
9
# File 'lib/ridley/ssh/response.rb', line 7

def stdout
  @stdout
end

Instance Method Details

#error?Boolean

Return true if the response was not successful

Returns:

  • (Boolean)

23
24
25
# File 'lib/ridley/ssh/response.rb', line 23

def error?
  self.exit_code != 0
end