Class: Trebuchet::Result
- Inherits:
-
Object
- Object
- Trebuchet::Result
- Defined in:
- lib/trebuchet/result.rb
Instance Method Summary collapse
- #add_parse(parse) ⇒ Object
- #failed_requests ⇒ Object
-
#initialize(parse = nil) ⇒ Result
constructor
A new instance of Result.
- #requests ⇒ Object
- #rps ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(parse = nil) ⇒ Result
Returns a new instance of Result.
3 4 5 6 7 8 |
# File 'lib/trebuchet/result.rb', line 3 def initialize parse=nil @requests = 0 @failed_requests = 0 @rps = 0.0 add_parse parse if parse end |
Instance Method Details
#add_parse(parse) ⇒ Object
10 11 12 13 14 |
# File 'lib/trebuchet/result.rb', line 10 def add_parse parse @requests = requests + parse.requests @failed_requests = failed_requests + parse.failed_requests @rps = rps + parse.rps end |
#failed_requests ⇒ Object
24 25 26 |
# File 'lib/trebuchet/result.rb', line 24 def failed_requests @failed_requests || 0 end |
#requests ⇒ Object
20 21 22 |
# File 'lib/trebuchet/result.rb', line 20 def requests @requests || 0 end |
#rps ⇒ Object
28 29 30 |
# File 'lib/trebuchet/result.rb', line 28 def rps @rps || 0 end |
#to_s ⇒ Object
16 17 18 |
# File 'lib/trebuchet/result.rb', line 16 def to_s "Requests: #{@requests}\nFailed Requests: #{@failed_requests}\nRequests Per Second: #{@rps}" end |