1
0
mirror of https://github.com/danbee/tube-status-server synced 2025-03-04 08:39:12 +00:00

Add mapping for weekend line names.

This commit is contained in:
Daniel Barber 2015-05-19 14:39:27 +01:00
parent 6b96a8a73c
commit f93dc44949

View File

@ -41,8 +41,10 @@ class Tubestatus < Sinatra::Base
messages = []
end
{ :id => line["Name"].first.downcase.gsub(/ (&)?/, ""),
:name => line["Name"].first,
name = weekend_line_mapping(line["Name"].first)
{ :id => name.downcase.gsub(/[^a-z]+/, "-"),
:name => name,
:status => line["Status"].first["Text"].first.downcase,
:messages => messages }
end
@ -50,4 +52,10 @@ class Tubestatus < Sinatra::Base
content_type :json
JSON data
end
def weekend_line_mapping(name)
mapping = { 'H\'smith & City' => 'Hammersmith and City',
'Waterloo & City' => 'Waterloo and City' }
mapping[name] || name
end
end