Class: Scallop::Result
- Inherits:
-
Object
- Object
- Scallop::Result
- Defined in:
- lib/scallop/result.rb
Overview
Represents a result of command execution.
Instance Attribute Summary collapse
-
#output ⇒ Object
readonly
Returns the value of attribute output.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#stderr ⇒ Object
readonly
Returns the value of attribute stderr.
-
#stdout ⇒ Object
readonly
Returns the value of attribute stdout.
-
#timing ⇒ Object
readonly
Returns the value of attribute timing.
Instance Method Summary collapse
-
#initialize(stdout:, stderr:, status:, timing:) ⇒ Result
constructor
A new instance of Result.
- #success? ⇒ Boolean
Constructor Details
#initialize(stdout:, stderr:, status:, timing:) ⇒ Result
Returns a new instance of Result.
12 13 14 15 16 17 18 |
# File 'lib/scallop/result.rb', line 12 def initialize(stdout:, stderr:, status:, timing:) @stdout = stdout @stderr = stderr @status = status @timing = timing @output = [stdout, stderr].reject { |s| s.nil? || s.empty? }.join("\n") end |
Instance Attribute Details
#output ⇒ Object (readonly)
Returns the value of attribute output.
10 11 12 |
# File 'lib/scallop/result.rb', line 10 def output @output end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
8 9 10 |
# File 'lib/scallop/result.rb', line 8 def status @status end |
#stderr ⇒ Object (readonly)
Returns the value of attribute stderr.
7 8 9 |
# File 'lib/scallop/result.rb', line 7 def stderr @stderr end |
#stdout ⇒ Object (readonly)
Returns the value of attribute stdout.
6 7 8 |
# File 'lib/scallop/result.rb', line 6 def stdout @stdout end |
#timing ⇒ Object (readonly)
Returns the value of attribute timing.
9 10 11 |
# File 'lib/scallop/result.rb', line 9 def timing @timing end |
Instance Method Details
#success? ⇒ Boolean
20 21 22 |
# File 'lib/scallop/result.rb', line 20 def success? @status.success? end |