Class: Aidp::Interfaces::CommandResult
- Inherits:
-
Object
- Object
- Aidp::Interfaces::CommandResult
- Defined in:
- lib/aidp/interfaces/command_executor_interface.rb
Overview
Result object returned by command execution. Immutable value object containing stdout, stderr, and exit status.
Instance Attribute Summary collapse
-
#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
-
#err ⇒ String
Alias for stderr for compatibility with TTY::Command::Result.
-
#initialize(stdout:, stderr:, exit_status:) ⇒ CommandResult
constructor
A new instance of CommandResult.
-
#out ⇒ String
Alias for stdout for compatibility with TTY::Command::Result.
-
#success? ⇒ Boolean
True if exit_status is 0.
Constructor Details
#initialize(stdout:, stderr:, exit_status:) ⇒ CommandResult
Returns a new instance of CommandResult.
60 61 62 63 64 65 |
# File 'lib/aidp/interfaces/command_executor_interface.rb', line 60 def initialize(stdout:, stderr:, exit_status:) @stdout = stdout.to_s.freeze @stderr = stderr.to_s.freeze @exit_status = exit_status.to_i freeze end |
Instance Attribute Details
#exit_status ⇒ Object (readonly)
Returns the value of attribute exit_status.
55 56 57 |
# File 'lib/aidp/interfaces/command_executor_interface.rb', line 55 def exit_status @exit_status end |
#stderr ⇒ Object (readonly)
Returns the value of attribute stderr.
55 56 57 |
# File 'lib/aidp/interfaces/command_executor_interface.rb', line 55 def stderr @stderr end |
#stdout ⇒ Object (readonly)
Returns the value of attribute stdout.
55 56 57 |
# File 'lib/aidp/interfaces/command_executor_interface.rb', line 55 def stdout @stdout end |
Instance Method Details
#err ⇒ String
Alias for stderr for compatibility with TTY::Command::Result
80 81 82 |
# File 'lib/aidp/interfaces/command_executor_interface.rb', line 80 def err @stderr end |
#out ⇒ String
Alias for stdout for compatibility with TTY::Command::Result
74 75 76 |
# File 'lib/aidp/interfaces/command_executor_interface.rb', line 74 def out @stdout end |
#success? ⇒ Boolean
Returns true if exit_status is 0.
68 69 70 |
# File 'lib/aidp/interfaces/command_executor_interface.rb', line 68 def success? @exit_status.zero? end |