Class: SSHake::Response
- Inherits:
-
Object
- Object
- SSHake::Response
- Defined in:
- lib/sshake/response.rb
Instance Attribute Summary collapse
-
#bytes_streamed ⇒ Object
Returns the value of attribute bytes_streamed.
-
#command ⇒ Object
Returns the value of attribute command.
-
#exit_code ⇒ Object
Returns the value of attribute exit_code.
-
#exit_signal ⇒ Object
Returns the value of attribute exit_signal.
-
#finish_time ⇒ Object
Returns the value of attribute finish_time.
-
#start_time ⇒ Object
Returns the value of attribute start_time.
-
#stderr ⇒ Object
Returns the value of attribute stderr.
-
#stdout ⇒ Object
Returns the value of attribute stdout.
Instance Method Summary collapse
- #cached! ⇒ Object
- #cached? ⇒ Boolean
-
#initialize(cached: false) ⇒ Response
constructor
A new instance of Response.
- #success? ⇒ Boolean
- #time ⇒ Object
- #timeout! ⇒ Object
- #timeout? ⇒ Boolean
Constructor Details
#initialize(cached: false) ⇒ Response
Returns a new instance of Response.
6 7 8 9 10 11 12 |
# File 'lib/sshake/response.rb', line 6 def initialize(cached: false) @stdout = '' @stderr = '' @exit_code = 0 @bytes_streamed = 0 @cached = cached end |
Instance Attribute Details
#bytes_streamed ⇒ Object
Returns the value of attribute bytes_streamed.
14 15 16 |
# File 'lib/sshake/response.rb', line 14 def bytes_streamed @bytes_streamed end |
#command ⇒ Object
Returns the value of attribute command.
14 15 16 |
# File 'lib/sshake/response.rb', line 14 def command @command end |
#exit_code ⇒ Object
Returns the value of attribute exit_code.
14 15 16 |
# File 'lib/sshake/response.rb', line 14 def exit_code @exit_code end |
#exit_signal ⇒ Object
Returns the value of attribute exit_signal.
14 15 16 |
# File 'lib/sshake/response.rb', line 14 def exit_signal @exit_signal end |
#finish_time ⇒ Object
Returns the value of attribute finish_time.
14 15 16 |
# File 'lib/sshake/response.rb', line 14 def finish_time @finish_time end |
#start_time ⇒ Object
Returns the value of attribute start_time.
14 15 16 |
# File 'lib/sshake/response.rb', line 14 def start_time @start_time end |
#stderr ⇒ Object
Returns the value of attribute stderr.
14 15 16 |
# File 'lib/sshake/response.rb', line 14 def stderr @stderr end |
#stdout ⇒ Object
Returns the value of attribute stdout.
14 15 16 |
# File 'lib/sshake/response.rb', line 14 def stdout @stdout end |
Instance Method Details
#cached! ⇒ Object
24 25 26 |
# File 'lib/sshake/response.rb', line 24 def cached! @cached = true end |
#cached? ⇒ Boolean
20 21 22 |
# File 'lib/sshake/response.rb', line 20 def cached? @cached == true end |
#success? ⇒ Boolean
16 17 18 |
# File 'lib/sshake/response.rb', line 16 def success? @exit_code.zero? end |
#time ⇒ Object
28 29 30 |
# File 'lib/sshake/response.rb', line 28 def time (finish_time - start_time).to_i end |
#timeout! ⇒ Object
36 37 38 |
# File 'lib/sshake/response.rb', line 36 def timeout! @exit_code = -255 end |
#timeout? ⇒ Boolean
32 33 34 |
# File 'lib/sshake/response.rb', line 32 def timeout? @exit_code == -255 end |