Class: Commandline::Return
- Inherits:
-
Object
- Object
- Commandline::Return
- Defined in:
- lib/utils/commandline/return.rb
Instance Attribute Summary collapse
-
#exit_code ⇒ Object
readonly
Returns the value of attribute exit_code.
-
#stderr ⇒ Object
readonly
Returns the value of attribute stderr.
-
#stdout ⇒ Object
readonly
Returns the value of attribute stdout.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #error? ⇒ Boolean
-
#initialize(stdout:, stderr:, exit_code:) ⇒ Return
constructor
A new instance of Return.
- #to_s ⇒ Object
Constructor Details
#initialize(stdout:, stderr:, exit_code:) ⇒ Return
Returns a new instance of Return.
5 6 7 8 9 |
# File 'lib/utils/commandline/return.rb', line 5 def initialize(stdout:, stderr:, exit_code:) @stdout = normalise(stdout) @stderr = normalise(stderr) @exit_code = exit_code end |
Instance Attribute Details
#exit_code ⇒ Object (readonly)
Returns the value of attribute exit_code.
3 4 5 |
# File 'lib/utils/commandline/return.rb', line 3 def exit_code @exit_code end |
#stderr ⇒ Object (readonly)
Returns the value of attribute stderr.
3 4 5 |
# File 'lib/utils/commandline/return.rb', line 3 def stderr @stderr end |
#stdout ⇒ Object (readonly)
Returns the value of attribute stdout.
3 4 5 |
# File 'lib/utils/commandline/return.rb', line 3 def stdout @stdout end |
Instance Method Details
#==(other) ⇒ Object
27 28 29 |
# File 'lib/utils/commandline/return.rb', line 27 def ==(other) other.to_s == to_s end |
#error? ⇒ Boolean
11 12 13 |
# File 'lib/utils/commandline/return.rb', line 11 def error? exit_code != 0 end |
#to_s ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/utils/commandline/return.rb', line 15 def to_s " EXIT CODE: \#{exit_code}\n\n STDOUT:\n \#{stdout}\n\n STDERR:\n \#{stderr}\n OUTPUT\nend\n" |