Class: Runbox::Result
- Inherits:
-
Object
- Object
- Runbox::Result
- Defined in:
- lib/runbox/result.rb
Instance Attribute Summary collapse
-
#execution_time_ms ⇒ Object
readonly
Returns the value of attribute execution_time_ms.
-
#exit_code ⇒ Object
readonly
Returns the value of attribute exit_code.
-
#packages ⇒ Object
readonly
Returns the value of attribute packages.
-
#stderr ⇒ Object
readonly
Returns the value of attribute stderr.
-
#stdout ⇒ Object
readonly
Returns the value of attribute stdout.
-
#success ⇒ Object
readonly
Returns the value of attribute success.
-
#timeout_exceeded ⇒ Object
readonly
Returns the value of attribute timeout_exceeded.
Instance Method Summary collapse
- #failed? ⇒ Boolean
-
#initialize(data) ⇒ Result
constructor
A new instance of Result.
- #success? ⇒ Boolean
- #timeout? ⇒ Boolean
- #to_h ⇒ Object
Constructor Details
#initialize(data) ⇒ Result
Returns a new instance of Result.
8 9 10 11 12 13 14 15 16 |
# File 'lib/runbox/result.rb', line 8 def initialize(data) @success = data["success"] || data[:success] @exit_code = data["exit_code"] || data[:exit_code] @stdout = data["stdout"] || data[:stdout] || "" @stderr = data["stderr"] || data[:stderr] || "" @execution_time_ms = data["execution_time_ms"] || data[:execution_time_ms] @timeout_exceeded = data["timeout_exceeded"] || data[:timeout_exceeded] || false @packages = data["packages"] || data[:packages] end |
Instance Attribute Details
#execution_time_ms ⇒ Object (readonly)
Returns the value of attribute execution_time_ms.
5 6 7 |
# File 'lib/runbox/result.rb', line 5 def execution_time_ms @execution_time_ms end |
#exit_code ⇒ Object (readonly)
Returns the value of attribute exit_code.
5 6 7 |
# File 'lib/runbox/result.rb', line 5 def exit_code @exit_code end |
#packages ⇒ Object (readonly)
Returns the value of attribute packages.
5 6 7 |
# File 'lib/runbox/result.rb', line 5 def packages @packages end |
#stderr ⇒ Object (readonly)
Returns the value of attribute stderr.
5 6 7 |
# File 'lib/runbox/result.rb', line 5 def stderr @stderr end |
#stdout ⇒ Object (readonly)
Returns the value of attribute stdout.
5 6 7 |
# File 'lib/runbox/result.rb', line 5 def stdout @stdout end |
#success ⇒ Object (readonly)
Returns the value of attribute success.
5 6 7 |
# File 'lib/runbox/result.rb', line 5 def success @success end |
#timeout_exceeded ⇒ Object (readonly)
Returns the value of attribute timeout_exceeded.
5 6 7 |
# File 'lib/runbox/result.rb', line 5 def timeout_exceeded @timeout_exceeded end |
Instance Method Details
#failed? ⇒ Boolean
22 23 24 |
# File 'lib/runbox/result.rb', line 22 def failed? !success? end |
#success? ⇒ Boolean
18 19 20 |
# File 'lib/runbox/result.rb', line 18 def success? @success == true end |
#timeout? ⇒ Boolean
26 27 28 |
# File 'lib/runbox/result.rb', line 26 def timeout? @timeout_exceeded == true end |
#to_h ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/runbox/result.rb', line 30 def to_h hash = { success: @success, exit_code: @exit_code, stdout: @stdout, stderr: @stderr, execution_time_ms: @execution_time_ms, timeout_exceeded: @timeout_exceeded } hash[:packages] = @packages if @packages hash end |