Class: SimpleMetarParser::MetarCity
- Defined in:
- lib/simple_metar_parser/metar/metar_city.rb
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Metar code of city.
-
#model ⇒ Object
readonly
Addition city information fetched using AR.
Attributes inherited from Base
Class Method Summary collapse
-
.find_by_metar(metar) ⇒ Object
Get city information using AR.
-
.rails_model=(klass) ⇒ Object
You can set AR model for fetching additional information about city.
Instance Method Summary collapse
Methods inherited from Base
Constructor Details
This class inherits a constructor from SimpleMetarParser::Base
Instance Attribute Details
#code ⇒ Object (readonly)
Metar code of city
33 34 35 |
# File 'lib/simple_metar_parser/metar/metar_city.rb', line 33 def code @code end |
#model ⇒ Object (readonly)
Addition city information fetched using AR
30 31 32 |
# File 'lib/simple_metar_parser/metar/metar_city.rb', line 30 def model @model end |
Class Method Details
.find_by_metar(metar) ⇒ Object
Get city information using AR
12 13 14 15 |
# File 'lib/simple_metar_parser/metar/metar_city.rb', line 12 def self.() return nil if not defined? @@rails_model_class or @@rails_model_class.nil? @@rails_model_class.() end |
.rails_model=(klass) ⇒ Object
You can set AR model for fetching additional information about city
7 8 9 |
# File 'lib/simple_metar_parser/metar/metar_city.rb', line 7 def self.rails_model=(klass) @@rails_model_class = klass end |
Instance Method Details
#decode_split(s) ⇒ Object
22 23 24 25 26 27 |
# File 'lib/simple_metar_parser/metar/metar_city.rb', line 22 def decode_split(s) if s =~ /^([A-Z]{4})$/ and not s == 'AUTO' and not s == 'GRID' and not s == 'WNDS' @code = $1 @model = self.class.(@code) end end |
#reset ⇒ Object
17 18 19 20 |
# File 'lib/simple_metar_parser/metar/metar_city.rb', line 17 def reset @code = nil @model = nil end |