Class: SimpleOpenWeatherMap::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/simple_open_weather_map/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config = {}) ⇒ Config

Returns a new instance of Config.



6
7
8
9
10
11
# File 'lib/simple_open_weather_map/config.rb', line 6

def initialize(config = {})
  raise "Hash only." unless config.is_a?(Hash)

  validate(config)
  parse(default_config.merge(config))
end

Instance Attribute Details

#app_idObject

Returns the value of attribute app_id.



4
5
6
# File 'lib/simple_open_weather_map/config.rb', line 4

def app_id
  @app_id
end

#city_idObject

Returns the value of attribute city_id.



4
5
6
# File 'lib/simple_open_weather_map/config.rb', line 4

def city_id
  @city_id
end

#forecast_daysObject

Returns the value of attribute forecast_days.



4
5
6
# File 'lib/simple_open_weather_map/config.rb', line 4

def forecast_days
  @forecast_days
end

#save_icon_dirObject

Returns the value of attribute save_icon_dir.



4
5
6
# File 'lib/simple_open_weather_map/config.rb', line 4

def save_icon_dir
  @save_icon_dir
end

#unitObject

Returns the value of attribute unit.



4
5
6
# File 'lib/simple_open_weather_map/config.rb', line 4

def unit
  @unit
end

Instance Method Details

#save_icon?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/simple_open_weather_map/config.rb', line 13

def save_icon?
  @save_icon || false
end