Class: Mihari::Structs::MMDB::CountryInfo
- Inherits:
-
Dry::Struct
- Object
- Dry::Struct
- Mihari::Structs::MMDB::CountryInfo
- Defined in:
- lib/mihari/structs/mmdb.rb
Instance Attribute Summary collapse
- #latitude ⇒ String readonly
- #longitude ⇒ String readonly
Class Method Summary collapse
Instance Attribute Details
#latitude ⇒ String (readonly)
29 |
# File 'lib/mihari/structs/mmdb.rb', line 29 attribute :latitude, Types::String |
#longitude ⇒ String (readonly)
33 |
# File 'lib/mihari/structs/mmdb.rb', line 33 attribute :longitude, Types::String |
Class Method Details
.from_dynamic!(d) ⇒ Object
35 36 37 38 39 40 41 |
# File 'lib/mihari/structs/mmdb.rb', line 35 def self.from_dynamic!(d) d = Types::Hash[d] new( latitude: d.fetch("Latitude (average)"), longitude: d.fetch("Longitude (average)") ) end |
.from_json!(json) ⇒ Object
44 45 46 |
# File 'lib/mihari/structs/mmdb.rb', line 44 def from_json!(json) from_dynamic!(JSON.parse(json)) end |