Class: MgTracker::Barometer

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

Overview

‘Barometer` gathers barometer-related data

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Barometer

Returns a new instance of Barometer.



8
9
10
11
12
# File 'lib/mg_tracker/barometer.rb', line 8

def initialize(options = {})
  @weather = weather = options[:weather] || Weather.new
  @city = weather.city = options[:city] || 'San Francisco'
  @state = weather.state = options[:state] || 'CA'
end

Instance Attribute Details

#cityObject (readonly)

Returns the value of attribute city.



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

def city
  @city
end

#stateObject (readonly)

Returns the value of attribute state.



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

def state
  @state
end

#weatherObject (readonly)

Returns the value of attribute weather.



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

def weather
  @weather
end

Instance Method Details

#inchesObject



14
15
16
# File 'lib/mg_tracker/barometer.rb', line 14

def inches
  weather.barometer_in
end

#mbObject



18
19
20
# File 'lib/mg_tracker/barometer.rb', line 18

def mb
  weather.barometer_mb
end

#trendObject



22
23
24
# File 'lib/mg_tracker/barometer.rb', line 22

def trend
  weather.barometer_trend
end