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

Sort tube lines.

This commit is contained in:
Daniel Barber 2015-05-19 14:47:27 +01:00
parent f93dc44949
commit 03cac6a1e3

View File

@ -27,7 +27,7 @@ class Tubestatus < Sinatra::Base
end
content_type :json
JSON data
JSON sort_lines(data)
end
get '/weekend.json' do
@ -50,7 +50,7 @@ class Tubestatus < Sinatra::Base
end
content_type :json
JSON data
JSON sort_lines(data)
end
def weekend_line_mapping(name)
@ -58,4 +58,8 @@ class Tubestatus < Sinatra::Base
'Waterloo & City' => 'Waterloo and City' }
mapping[name] || name
end
def sort_lines(lines)
lines.sort { |x, y| x[:name] <=> y[:name] }
end
end