Class: Tomo::Result
- Inherits:
-
Object
- Object
- Tomo::Result
- Defined in:
- lib/tomo/result.rb
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.
Class Method Summary collapse
Instance Method Summary collapse
- #failure? ⇒ Boolean
-
#initialize(stdout:, stderr:, exit_status:) ⇒ Result
constructor
A new instance of Result.
- #output ⇒ Object
- #success? ⇒ Boolean
Constructor Details
#initialize(stdout:, stderr:, exit_status:) ⇒ Result
Returns a new instance of Result.
11 12 13 14 15 16 |
# File 'lib/tomo/result.rb', line 11 def initialize(stdout:, stderr:, exit_status:) @stdout = stdout @stderr = stderr @exit_status = exit_status freeze end |
Instance Attribute Details
#exit_status ⇒ Object (readonly)
Returns the value of attribute exit_status.
9 10 11 |
# File 'lib/tomo/result.rb', line 9 def exit_status @exit_status end |
#stderr ⇒ Object (readonly)
Returns the value of attribute stderr.
9 10 11 |
# File 'lib/tomo/result.rb', line 9 def stderr @stderr end |
#stdout ⇒ Object (readonly)
Returns the value of attribute stdout.
9 10 11 |
# File 'lib/tomo/result.rb', line 9 def stdout @stdout end |
Class Method Details
.empty_success ⇒ Object
5 6 7 |
# File 'lib/tomo/result.rb', line 5 def self.empty_success new(stdout: +"", stderr: +"", exit_status: 0) end |
Instance Method Details
#failure? ⇒ Boolean
22 23 24 |
# File 'lib/tomo/result.rb', line 22 def failure? !success? end |
#output ⇒ Object
26 27 28 |
# File 'lib/tomo/result.rb', line 26 def output [stdout, stderr].compact.join end |
#success? ⇒ Boolean
18 19 20 |
# File 'lib/tomo/result.rb', line 18 def success? exit_status.zero? end |