Class: Trebuchet::Result

Inherits:
Object
  • Object
show all
Defined in:
lib/trebuchet/result.rb

Instance Method Summary collapse

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_requestsObject



24
25
26
# File 'lib/trebuchet/result.rb', line 24

def failed_requests
  @failed_requests || 0
end

#requestsObject



20
21
22
# File 'lib/trebuchet/result.rb', line 20

def requests
  @requests || 0
end

#rpsObject



28
29
30
# File 'lib/trebuchet/result.rb', line 28

def rps
  @rps || 0
end

#to_sObject



16
17
18
# File 'lib/trebuchet/result.rb', line 16

def to_s
  "Requests: #{@requests}\nFailed Requests: #{@failed_requests}\nRequests Per Second: #{@rps}"
end