Class: Sxn::Security::SecureCommandExecutor::CommandResult
- Inherits:
-
Object
- Object
- Sxn::Security::SecureCommandExecutor::CommandResult
- Defined in:
- lib/sxn/security/secure_command_executor.rb
Overview
Command execution result
Instance Attribute Summary collapse
-
#command ⇒ Object
readonly
Returns the value of attribute command.
-
#duration ⇒ Object
readonly
Returns the value of attribute duration.
-
#exit_status ⇒ Object
readonly
Returns the value of attribute exit_status.
-
#stderr ⇒ Object
readonly
Returns the value of attribute stderr.
-
#stdout ⇒ Object
readonly
Returns the value of attribute stdout.
Instance Method Summary collapse
- #failure? ⇒ Boolean
-
#initialize(exit_status, stdout, stderr, command, duration) ⇒ CommandResult
constructor
A new instance of CommandResult.
- #success? ⇒ Boolean
- #to_h ⇒ Object
Constructor Details
#initialize(exit_status, stdout, stderr, command, duration) ⇒ CommandResult
Returns a new instance of CommandResult.
26 27 28 29 30 31 32 |
# File 'lib/sxn/security/secure_command_executor.rb', line 26 def initialize(exit_status, stdout, stderr, command, duration) @exit_status = exit_status @stdout = stdout || "" @stderr = stderr || "" @command = command @duration = duration end |
Instance Attribute Details
#command ⇒ Object (readonly)
Returns the value of attribute command.
24 25 26 |
# File 'lib/sxn/security/secure_command_executor.rb', line 24 def command @command end |
#duration ⇒ Object (readonly)
Returns the value of attribute duration.
24 25 26 |
# File 'lib/sxn/security/secure_command_executor.rb', line 24 def duration @duration end |
#exit_status ⇒ Object (readonly)
Returns the value of attribute exit_status.
24 25 26 |
# File 'lib/sxn/security/secure_command_executor.rb', line 24 def exit_status @exit_status end |
#stderr ⇒ Object (readonly)
Returns the value of attribute stderr.
24 25 26 |
# File 'lib/sxn/security/secure_command_executor.rb', line 24 def stderr @stderr end |
#stdout ⇒ Object (readonly)
Returns the value of attribute stdout.
24 25 26 |
# File 'lib/sxn/security/secure_command_executor.rb', line 24 def stdout @stdout end |
Instance Method Details
#failure? ⇒ Boolean
38 39 40 |
# File 'lib/sxn/security/secure_command_executor.rb', line 38 def failure? !success? end |
#success? ⇒ Boolean
34 35 36 |
# File 'lib/sxn/security/secure_command_executor.rb', line 34 def success? @exit_status.zero? end |
#to_h ⇒ Object
42 43 44 45 46 47 48 49 50 51 |
# File 'lib/sxn/security/secure_command_executor.rb', line 42 def to_h { exit_status: @exit_status, stdout: @stdout, stderr: @stderr, command: @command, duration: @duration, success: success? } end |