Class: Lavin::Stats
- Inherits:
-
Object
- Object
- Lavin::Stats
- Defined in:
- lib/lavin/stats.rb
Instance Attribute Summary collapse
-
#duration ⇒ Object
readonly
Returns the value of attribute duration.
-
#failures ⇒ Object
readonly
Returns the value of attribute failures.
-
#rate ⇒ Object
readonly
Returns the value of attribute rate.
-
#requests ⇒ Object
readonly
Returns the value of attribute requests.
-
#step_summary ⇒ Object
readonly
Returns the value of attribute step_summary.
-
#steps ⇒ Object
readonly
Returns the value of attribute steps.
-
#total_requests ⇒ Object
readonly
Returns the value of attribute total_requests.
Instance Method Summary collapse
- #each_failure(&block) ⇒ Object
- #each_request(&block) ⇒ Object
- #each_step(&block) ⇒ Object
- #empty? ⇒ Boolean
- #failed_steps ⇒ Object
-
#initialize(duration:, total_requests:, rate:, requests: [], step_summary: {}, steps: [], failures: []) ⇒ Stats
constructor
A new instance of Stats.
- #successful_steps ⇒ Object
- #to_h ⇒ Object
- #total_steps ⇒ Object
Constructor Details
#initialize(duration:, total_requests:, rate:, requests: [], step_summary: {}, steps: [], failures: []) ⇒ Stats
Returns a new instance of Stats.
7 8 9 10 11 12 13 14 15 |
# File 'lib/lavin/stats.rb', line 7 def initialize(duration:, total_requests:, rate:, requests: [], step_summary: {}, steps: [], failures: []) @duration = duration @total_requests = total_requests @rate = rate @requests = requests @step_summary = step_summary @steps = steps @failures = failures end |
Instance Attribute Details
#duration ⇒ Object (readonly)
Returns the value of attribute duration.
5 6 7 |
# File 'lib/lavin/stats.rb', line 5 def duration @duration end |
#failures ⇒ Object (readonly)
Returns the value of attribute failures.
5 6 7 |
# File 'lib/lavin/stats.rb', line 5 def failures @failures end |
#rate ⇒ Object (readonly)
Returns the value of attribute rate.
5 6 7 |
# File 'lib/lavin/stats.rb', line 5 def rate @rate end |
#requests ⇒ Object (readonly)
Returns the value of attribute requests.
5 6 7 |
# File 'lib/lavin/stats.rb', line 5 def requests @requests end |
#step_summary ⇒ Object (readonly)
Returns the value of attribute step_summary.
5 6 7 |
# File 'lib/lavin/stats.rb', line 5 def step_summary @step_summary end |
#steps ⇒ Object (readonly)
Returns the value of attribute steps.
5 6 7 |
# File 'lib/lavin/stats.rb', line 5 def steps @steps end |
#total_requests ⇒ Object (readonly)
Returns the value of attribute total_requests.
5 6 7 |
# File 'lib/lavin/stats.rb', line 5 def total_requests @total_requests end |
Instance Method Details
#each_failure(&block) ⇒ Object
53 54 55 |
# File 'lib/lavin/stats.rb', line 53 def each_failure(&block) failures.each(&block) end |
#each_request(&block) ⇒ Object
49 50 51 |
# File 'lib/lavin/stats.rb', line 49 def each_request(&block) requests.each(&block) end |
#each_step(&block) ⇒ Object
45 46 47 |
# File 'lib/lavin/stats.rb', line 45 def each_step(&block) steps.each(&block) end |
#empty? ⇒ Boolean
17 18 19 |
# File 'lib/lavin/stats.rb', line 17 def empty? requests.empty? end |
#failed_steps ⇒ Object
41 42 43 |
# File 'lib/lavin/stats.rb', line 41 def failed_steps @step_summary[:failure] end |
#successful_steps ⇒ Object
37 38 39 |
# File 'lib/lavin/stats.rb', line 37 def successful_steps @step_summary[:success] end |
#to_h ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/lavin/stats.rb', line 21 def to_h { duration:, total_requests:, rate:, requests:, step_summary:, steps:, failures: } end |
#total_steps ⇒ Object
33 34 35 |
# File 'lib/lavin/stats.rb', line 33 def total_steps @step_summary[:count] end |