Class: OpenMeteo::Entities::Forecast::Units
- Inherits:
-
Object
- Object
- OpenMeteo::Entities::Forecast::Units
- Defined in:
- lib/open_meteo/entities/forecast/units.rb
Overview
A forecast entity for data units returned by OpenMeteo
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#raw_json_units ⇒ Object
readonly
Returns the value of attribute raw_json_units.
-
#time ⇒ Object
readonly
Returns the value of attribute time.
Instance Method Summary collapse
-
#initialize(json_units) ⇒ Units
constructor
A new instance of Units.
Constructor Details
#initialize(json_units) ⇒ Units
Returns a new instance of Units.
9 10 11 12 13 14 |
# File 'lib/open_meteo/entities/forecast/units.rb', line 9 def initialize(json_units) @raw_json_units = json_units @attributes = json_units.keys @time = json_units["time"] end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args) ⇒ Object (private)
18 19 20 21 22 23 24 |
# File 'lib/open_meteo/entities/forecast/units.rb', line 18 def method_missing(name, *args) if raw_json_units.key?(name.to_s) raw_json_units[name.to_s] else super end end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
7 8 9 |
# File 'lib/open_meteo/entities/forecast/units.rb', line 7 def attributes @attributes end |
#raw_json_units ⇒ Object (readonly)
Returns the value of attribute raw_json_units.
7 8 9 |
# File 'lib/open_meteo/entities/forecast/units.rb', line 7 def raw_json_units @raw_json_units end |
#time ⇒ Object (readonly)
Returns the value of attribute time.
7 8 9 |
# File 'lib/open_meteo/entities/forecast/units.rb', line 7 def time @time end |