Class: Barometer::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/barometer/base.rb

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (Base) initialize(query, units = :metric)



5
6
7
8
# File 'lib/barometer/base.rb', line 5

def initialize(query, units=:metric)
  @query = Query.new(query, units)
  @weather = Weather.new(units)
end

Instance Attribute Details

- (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



10
11
12
13
14
15
# File 'lib/barometer/base.rb', line 10

def measure
  record_time do
    measure_until_successful or raise OutOfSources
  end
  weather
end