Class: PageResponseScale
- Defined in:
- lib/mobiusloop/scales/page_response_scale.rb
Overview
Records the response time of a web page
Instance Attribute Summary collapse
-
#location ⇒ Object
Returns the value of attribute location.
Instance Method Summary collapse
-
#measure ⇒ Object
returns a new Measure with response time of the :location.
Methods inherited from Scale
Constructor Details
This class inherits a constructor from Scale
Instance Attribute Details
#location ⇒ Object
Returns the value of attribute location.
10 11 12 |
# File 'lib/mobiusloop/scales/page_response_scale.rb', line 10 def location @location end |
Instance Method Details
#measure ⇒ Object
returns a new Measure with response time of the :location
13 14 15 16 17 18 19 |
# File 'lib/mobiusloop/scales/page_response_scale.rb', line 13 def measure @location = "http://google.com" if @location == nil time = Benchmark.measure do response = Net::HTTP.get_response(URI.parse(@location)) end Measure.new(time.real) end |