Class: OpenWeather::Models::Model
- Inherits:
-
Hashie::Trash
- Object
- Hashie::Trash
- OpenWeather::Models::Model
- Includes:
- Hashie::Extensions::IgnoreUndeclared, OpenWeather::Models::Mixins::Speed, OpenWeather::Models::Mixins::Temp
- Defined in:
- lib/open_weather/models/model.rb
Direct Known Subclasses
City::Weather, Clouds, Coord, Forecast::City, Forecast::Forecast, Forecast::Hourly, List, Main, OneCall::Alert, OneCall::CurrentWeather, OneCall::DailyWeather, OneCall::FeelsLike, OneCall::HourlyWeather, OneCall::MinutelyWeather, OneCall::Temp, OneCall::Weather, Rain, Snow, Station, Stations::Humidity, Stations::Measurement, Stations::Precipitation, Stations::Pressure, Stations::Temp, Sys, Weather, Wind
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
-
#initialize(args = nil, options = {}) ⇒ Model
constructor
A new instance of Model.
- #units ⇒ Object
Constructor Details
#initialize(args = nil, options = {}) ⇒ Model
Returns a new instance of Model.
12 13 14 15 16 |
# File 'lib/open_weather/models/model.rb', line 12 def initialize(args = nil, = {}) transformed_args = args.respond_to?(:transform_keys) ? args.transform_keys(&:to_s) : args super transformed_args @options = { units: OpenWeather.config.units }.merge( || {}) end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
10 11 12 |
# File 'lib/open_weather/models/model.rb', line 10 def @options end |
Instance Method Details
#units ⇒ Object
18 19 20 |
# File 'lib/open_weather/models/model.rb', line 18 def units && [:units]&.to_sym end |