Sha256: b8e58210ab009c7b956fb4af70d926c03eec14e7912cba220ff89401adf61c6c

Contents?: true

Size: 454 Bytes

Versions: 2

Compression:

Stored size: 454 Bytes

Contents

require 'benchmark'
require 'mobiusloop/scale'

require "net/http"
require "uri"

# Records the response time of a web page
class PageResponseScale < Scale

  attr_accessor :location

  # returns a new Measure with response time of the :location
  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
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mobiusloop-0.1.5 lib/mobiusloop/scales/page_response_scale.rb
mobiusloop-0.1.3 lib/mobiusloop/scales/page_response_scale.rb