module SunbusRingRoad
Public Instance Methods
Source
# File lib/sunbus/ringroad.rb, line 13 def drive_time_one_go(region: SunbusConfig::DEFAULT_REGION) code = SunbusConfig.normalize_region(region) || SunbusConfig::DEFAULT_REGION unless code == "tsv" return { error: "Ring Road drive time is Townsville only โ Bruce Highway bypass is 19 km." } end length_km = SunbusConfig::RING_ROAD_LENGTH_KM speed_kph = SunbusConfig::RING_ROAD_SPEED_KPH minutes = ((length_km.to_f / speed_kph) * 60).round { name: "Townsville Ring Road", length_km: length_km, speed_kph: speed_kph, minutes: minutes } end
Source
# File lib/sunbus/ringroad.rb, line 31 def format_report(name:, length_km:, speed_kph:, minutes:) require_relative "../irc_reply" style = IrcFormat.color(0, 4) IrcReply.card( tag: "SUNBUS", title: "Ring Road ยท one go", body_lines: [ "Length โ #{length_km} km", "Speed โ #{speed_kph} km/h (motorway limit)", "Duration โ #{minutes} min without stopping" ], footer_parts: [name, "TransLink ยท Townsville"], heading_style: style ) end