Class: Simmer::Suite::Result
- Inherits:
-
Object
- Object
- Simmer::Suite::Result
- Defined in:
- lib/simmer/suite/result.rb
Overview
The return object for a Session#run call.
Instance Attribute Summary collapse
-
#runner_results ⇒ Object
readonly
Returns the value of attribute runner_results.
Instance Method Summary collapse
- #fail? ⇒ Boolean
-
#initialize(runner_results = []) ⇒ Result
constructor
A new instance of Result.
- #pass? ⇒ Boolean (also: #passing?)
- #time_in_seconds ⇒ Object
- #to_h ⇒ Object
Constructor Details
#initialize(runner_results = []) ⇒ Result
Returns a new instance of Result.
16 17 18 19 20 |
# File 'lib/simmer/suite/result.rb', line 16 def initialize(runner_results = []) @runner_results = Array(runner_results) freeze end |
Instance Attribute Details
#runner_results ⇒ Object (readonly)
Returns the value of attribute runner_results.
14 15 16 |
# File 'lib/simmer/suite/result.rb', line 14 def runner_results @runner_results end |
Instance Method Details
#fail? ⇒ Boolean
27 28 29 |
# File 'lib/simmer/suite/result.rb', line 27 def fail? runner_results.any?(&:fail?) end |
#pass? ⇒ Boolean Also known as: passing?
22 23 24 |
# File 'lib/simmer/suite/result.rb', line 22 def pass? !fail? end |
#time_in_seconds ⇒ Object
31 32 33 34 35 |
# File 'lib/simmer/suite/result.rb', line 31 def time_in_seconds runner_results.inject(0.0) do |memo, runner_result| memo + runner_result.time_in_seconds end end |
#to_h ⇒ Object
37 38 39 40 41 42 43 |
# File 'lib/simmer/suite/result.rb', line 37 def to_h { 'pass' => pass?, 'time_in_seconds' => time_in_seconds, 'runner_results' => runner_results.map(&:to_h) } end |