Class: CommandLine::Result
- Inherits:
-
Object
- Object
- CommandLine::Result
- Defined in:
- lib/command_line/result.rb
Overview
The result returned from running command_line.
Instance Attribute Summary collapse
-
#stderr ⇒ String
readonly
The complete contents of stderr after running the application.
-
#stdout ⇒ String
readonly
The complete contents of stdout after running the application.
Instance Method Summary collapse
-
#exited? ⇒ Boolean
Returns
true
if the application exited normally. -
#exitstatus ⇒ Integer?
The numeric exit status of the application if it exited normally.
-
#failure? ⇒ Boolean
Returns
true
if the command failed to exit normally or exited with a failing status. -
#initialize(stdout, stderr, status) ⇒ Result
constructor
A new instance of Result.
-
#success? ⇒ Boolean
Returns
true
if the command exited normally with a success status.
Constructor Details
#initialize(stdout, stderr, status) ⇒ Result
Returns a new instance of Result.
6 7 8 9 10 |
# File 'lib/command_line/result.rb', line 6 def initialize(stdout, stderr, status) @stdout = stdout @stderr = stderr @status = status end |
Instance Attribute Details
#stderr ⇒ String (readonly)
The complete contents of stderr after running the application.
28 29 30 |
# File 'lib/command_line/result.rb', line 28 def stderr @stderr end |
#stdout ⇒ String (readonly)
The complete contents of stdout after running the application.
19 20 21 |
# File 'lib/command_line/result.rb', line 19 def stdout @stdout end |
Instance Method Details
#exited? ⇒ Boolean
Returns true
if the application exited normally.
36 37 38 |
# File 'lib/command_line/result.rb', line 36 def exited? @status.exited? end |
#exitstatus ⇒ Integer?
The numeric exit status of the application if it exited normally.
49 50 51 |
# File 'lib/command_line/result.rb', line 49 def exitstatus @status.exitstatus end |
#failure? ⇒ Boolean
Returns true
if the command failed to exit normally or exited with a
failing status.
72 73 74 |
# File 'lib/command_line/result.rb', line 72 def failure? !success? end |
#success? ⇒ Boolean
Returns true
if the command exited normally with a success status.
60 61 62 |
# File 'lib/command_line/result.rb', line 60 def success? !@status.nil? && @status.success? end |