Class: Barometer::Base
- Inherits:
-
Object
- Object
- Barometer::Base
- Defined in:
- lib/barometer/base.rb
Instance Attribute Summary collapse
-
#weather ⇒ Object
readonly
Returns the value of attribute weather.
Instance Method Summary collapse
-
#initialize(query, units = :metric) ⇒ Base
constructor
A new instance of Base.
- #measure ⇒ Object
Constructor Details
#initialize(query, units = :metric) ⇒ Base
Returns a new instance of Base.
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
#weather ⇒ Object (readonly)
Returns the value of attribute weather.
3 4 5 |
# File 'lib/barometer/base.rb', line 3 def weather @weather end |
Instance Method Details
#measure ⇒ Object
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 |