Class: MgTracker::Weather

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

Overview

‘Weather` makes various data about the weather available

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(service = WeatherService.new, options = {}) ⇒ Weather

Returns a new instance of Weather.



9
10
11
12
13
# File 'lib/mg_tracker/weather.rb', line 9

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

Instance Attribute Details

#cityObject

Returns the value of attribute city.



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

def city
  @city
end

#serviceObject (readonly)

Returns the value of attribute service.



7
8
9
# File 'lib/mg_tracker/weather.rb', line 7

def service
  @service
end

#stateObject

Returns the value of attribute state.



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

def state
  @state
end