module SunbusConfig
SunbusConfig — region constants, GTFS/RSS URLs, and region normalization for !sunbus. Public: normalize_region, region_meta, gtfs_zip_url, region_label, region_rss_category, rss_feed_url Depends: (none) Tests: test/lib/sunbus_parse_test.rb
Constants
- DEFAULT_REGION
- GTFS_CACHE_DIR
- GTFS_CACHE_MAX_AGE_SEC
- MAX_DEPARTURES
- MAX_STOPS
- MAX_SUBURB_STOPS
- PLUGIN_NAME
- REGIONS
- RING_ROAD_LENGTH_KM
- RING_ROAD_SPEED_KPH
- RSS_FEEDS
Public Instance Methods
Source
# File lib/sunbus/config.rb, line 62 def gtfs_zip_url(region) region_meta(region)[:gtfs_url] end
Source
# File lib/sunbus/config.rb, line 46 def normalize_region(value) needle = value.to_s.strip.downcase return DEFAULT_REGION if needle.empty? REGIONS.each do |code, meta| return code if code == needle return code if meta[:aliases].include?(needle) end nil end
Source
# File lib/sunbus/config.rb, line 66 def region_label(code) region_meta(code)[:name] end
Source
# File lib/sunbus/config.rb, line 58 def region_meta(code) REGIONS[code.to_s] || REGIONS[DEFAULT_REGION] end
Source
# File lib/sunbus/config.rb, line 70 def region_rss_category(code) region_meta(code)[:rss_category] end
Source
# File lib/sunbus/config.rb, line 74 def rss_feed_url(key) RSS_FEEDS.fetch(key) end