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:
parent
f93dc44949
commit
03cac6a1e3
@ -27,7 +27,7 @@ class Tubestatus < Sinatra::Base
|
|||||||
end
|
end
|
||||||
|
|
||||||
content_type :json
|
content_type :json
|
||||||
JSON data
|
JSON sort_lines(data)
|
||||||
end
|
end
|
||||||
|
|
||||||
get '/weekend.json' do
|
get '/weekend.json' do
|
||||||
@ -50,7 +50,7 @@ class Tubestatus < Sinatra::Base
|
|||||||
end
|
end
|
||||||
|
|
||||||
content_type :json
|
content_type :json
|
||||||
JSON data
|
JSON sort_lines(data)
|
||||||
end
|
end
|
||||||
|
|
||||||
def weekend_line_mapping(name)
|
def weekend_line_mapping(name)
|
||||||
@ -58,4 +58,8 @@ class Tubestatus < Sinatra::Base
|
|||||||
'Waterloo & City' => 'Waterloo and City' }
|
'Waterloo & City' => 'Waterloo and City' }
|
||||||
mapping[name] || name
|
mapping[name] || name
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def sort_lines(lines)
|
||||||
|
lines.sort { |x, y| x[:name] <=> y[:name] }
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user