From dc9a1c2a7a463345eade0fd058fd5119f3d39742 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sun, 4 Dec 2011 10:10:24 +0100 Subject: Route/Part: _stop_and_platform: Only concatenate if platform is non-empty --- lib/Travel/Routing/DE/VRR/Route/Part.pm | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'lib/Travel/Routing') diff --git a/lib/Travel/Routing/DE/VRR/Route/Part.pm b/lib/Travel/Routing/DE/VRR/Route/Part.pm index e49e122..7fdb6da 100644 --- a/lib/Travel/Routing/DE/VRR/Route/Part.pm +++ b/lib/Travel/Routing/DE/VRR/Route/Part.pm @@ -28,14 +28,23 @@ sub new { sub arrival_stop_and_platform { my ($self) = @_; - return sprintf( '%s: %s', $self->get(qw(arrival_stop arrival_platform)) ); + if ( length( $self->arrival_platform ) ) { + return + sprintf( '%s: %s', $self->get(qw(arrival_stop arrival_platform)) ); + } + return $self->arrival_stop; } sub departure_stop_and_platform { my ($self) = @_; - return - sprintf( '%s: %s', $self->get(qw(departure_stop departure_platform)) ); + if ( length( $self->departure_platform ) ) { + + return + sprintf( '%s: %s', + $self->get(qw(departure_stop departure_platform)) ); + } + return $self->arrival_stop; } sub extra { -- cgit v1.2.3