Class: VfrUtils::BaseService

Inherits:
Object
  • Object
show all
Defined in:
lib/vfr_utils/base_service.rb

Direct Known Subclasses

METAR, NOTAM, TAF

Class Method Summary collapse

Class Method Details

.get(icao_codes) ⇒ Object


21
22
23
24
25
26
27
28
29
30
# File 'lib/vfr_utils/base_service.rb', line 21

def get(icao_codes)
  icao_codes = [*icao_codes]
  icao_codes.map!(&:upcase)

  ret = {}
  icao_codes.each do |icao_code|
    ret[icao_code] = get_one(icao_code)
  end
  ret
end

.get_one(icao_code) ⇒ Object


32
33
34
# File 'lib/vfr_utils/base_service.rb', line 32

def get_one(icao_code)
  raise "Implement me!"
end

.inherited(child_class) ⇒ Object


11
12
13
14
15
16
17
18
19
# File 'lib/vfr_utils/base_service.rb', line 11

def inherited(child_class)
  def child_class.cache
    unless @cache
      config_key = self.name.split('::').last.downcase.to_sym
      @cache = Cache.new(VfrUtils.master_configuration.send(config_key))
    end
    @cache
  end
end