Module: FCC::Station

Defined in:
lib/fcc/station.rb,
lib/fcc/station/info.rb,
lib/fcc/station/cache.rb,
lib/fcc/station/index.rb,
lib/fcc/station/extended_info.rb,
lib/fcc/station/result_delegate.rb,
lib/fcc/station/extended_info/parser.rb

Defined Under Namespace

Classes: Cache, Community, Contact, ExtendedInfo, ExtendedInfoParser, Index, Info, Result, ResultDelegate

Class Method Summary collapse

Class Method Details

.extended_info_cache(service) ⇒ Object



37
38
39
40
41
# File 'lib/fcc/station.rb', line 37

def self.extended_info_cache(service) 
  @cache ||= {}
  @cache[service] ||= Station::Cache.new(service)
  @cache[service]
end

.find(service, call_sign, options = {}) ⇒ Object



20
21
22
# File 'lib/fcc/station.rb', line 20

def self.find(service, call_sign, options = {})
  Result.new(service, call_sign, options)
end

.find_each(service, &block) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/fcc/station.rb', line 12

def self.find_each(service, &block)
  results = index(service).results

  results.each do |result|
    yield find(service, result['callSign'])
  end
end

.index(service) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/fcc/station.rb', line 24

def self.index(service)
  case service.to_s.downcase.to_sym
  when :fm
    @fm_index ||= Index.new(:fm)
  when :am
    @am_index ||= Index.new(:am)
  when :tv
    @tv_index ||= Index.new(:tv)
  else
    raise "unsupported service #{service}. :fm, :am, and :tv are valid"
  end
end