summaryrefslogtreecommitdiff
path: root/index.pl
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2015-05-07 21:50:59 +0200
committerDaniel Friesel <derf@finalrewind.org>2015-05-07 21:50:59 +0200
commit2e5e35d929a7aa977dbebc280b6081bf49ad8a31 (patch)
tree299c6953058483f00daa29e2e5415f07a8bb19da /index.pl
parent578c436831c40c13c71d389ed875584a8a87283f (diff)
index: @departures construction: code cleanup
Diffstat (limited to 'index.pl')
-rw-r--r--index.pl18
1 files changed, 6 insertions, 12 deletions
diff --git a/index.pl b/index.pl
index 03908fc..6532efd 100644
--- a/index.pl
+++ b/index.pl
@@ -449,10 +449,8 @@ sub handle_request {
origin => $result->origin,
platform => $platform,
info => $info,
- is_cancelled => $result->can('is_cancelled')
- ? $result->is_cancelled
- : undef,
- messages => {
+ is_cancelled => $result->is_cancelled,
+ messages => {
delay => [
map { { timestamp => $_->[0], text => $_->[1] } }
$result->delay_messages
@@ -466,18 +464,14 @@ sub handle_request {
delay => $delay,
additional_stops => [ $result->additional_stops ],
canceled_stops => [ $result->canceled_stops ],
- replaced_by => $result->can('replaced_by')
- ? [
+ replaced_by => [
map { $_->type . q{ } . $_->train_no }
$result->replaced_by
- ]
- : [],
- replacement_for => $result->can('replacement_for')
- ? [
+ ],
+ replacement_for => [
map { $_->type . q{ } . $_->train_no }
$result->replacement_for
- ]
- : [],
+ ],
}
);
}