Class: Brut::CLI::ExecutionResults::Result
- Inherits:
-
Object
- Object
- Brut::CLI::ExecutionResults::Result
- Defined in:
- lib/brut/cli/execution_results.rb
Overview
Base class for all results.
Instance Attribute Summary collapse
-
#message ⇒ Strting
readonly
Any message provided in the results.
Instance Method Summary collapse
-
#initialize(exit_status:, message: nil) ⇒ Result
constructor
Create a new result.
-
#ok? ⇒ true|false
True if the execution of the command succeeded or didn't error.
-
#show_usage? ⇒ true|false
True if the result means that the user should be show CLI usage in addition to any messaging.
-
#stop? ⇒ true|false
True if execution internal to the command should stop.
-
#to_i ⇒ Integer
The exit status.
Constructor Details
#initialize(exit_status:, message: nil) ⇒ Result
Create a new result
command. All other values have command-defined meanings.
16 17 18 19 |
# File 'lib/brut/cli/execution_results.rb', line 16 def initialize(exit_status:,message:nil) @exit_status = exit_status @message = end |
Instance Attribute Details
#message ⇒ Strting (readonly)
Returns any message provided in the results. Generally nil
for successful results.
9 10 11 |
# File 'lib/brut/cli/execution_results.rb', line 9 def @message end |
Instance Method Details
#ok? ⇒ true|false
Returns true if the execution of the command succeeded or didn't error.
24 25 |
# File 'lib/brut/cli/execution_results.rb', line 24 def ok? = @exit_status == 0 # @return [Integer] the exit status |
#show_usage? ⇒ true|false
Returns true if the result means that the user should be show CLI usage in addition to any messaging.
28 |
# File 'lib/brut/cli/execution_results.rb', line 28 def show_usage? = false |
#stop? ⇒ true|false
Returns true if execution internal to the command should stop.
22 23 |
# File 'lib/brut/cli/execution_results.rb', line 22 def stop? = @exit_status != 0 # @return [true|false] true if the execution of the command succeeded or didn't error |
#to_i ⇒ Integer
Returns the exit status.
26 27 |
# File 'lib/brut/cli/execution_results.rb', line 26 def to_i = @exit_status # @return [true|false] true if the result means that the user should be show CLI usage in addition to any messaging. |