Class: Barometer::Base
- Inherits:
-
Object
- Object
- Barometer::Base
- Defined in:
- lib/barometer/base.rb
Instance Attribute Summary (collapse)
-
- (Object) query
readonly
Returns the value of attribute query.
-
- (Object) weather
readonly
Returns the value of attribute weather.
Instance Method Summary (collapse)
-
- (Base) initialize(query)
constructor
A new instance of Base.
- - (Object) measure(metric = nil)
Constructor Details
- (Base) initialize(query)
A new instance of Base
5 6 7 8 |
# File 'lib/barometer/base.rb', line 5 def initialize(query) @query = Barometer::Query.new(query) @weather = Barometer::Weather.new end |
Instance Attribute Details
- (Object) query (readonly)
Returns the value of attribute query
3 4 5 |
# File 'lib/barometer/base.rb', line 3 def query @query end |
- (Object) weather (readonly)
Returns the value of attribute weather
3 4 5 |
# File 'lib/barometer/base.rb', line 3 def weather @weather end |
Instance Method Details
- (Object) measure(metric = nil)
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/barometer/base.rb', line 10 def measure(metric=nil) @weather.start_at = Time.now.utc tier = 1 until @weather.success? Utils::ConfigReader.each_service(tier) do |source, config| = { :metric => metric }.merge!(config) _measure(source, ) end tier += 1 end @weather.end_at = Time.now.utc @weather end |