summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/Travel/Status/DE/DBRIS/Journey.pm15
1 files changed, 14 insertions, 1 deletions
diff --git a/lib/Travel/Status/DE/DBRIS/Journey.pm b/lib/Travel/Status/DE/DBRIS/Journey.pm
index f85c3c3..7b135e0 100644
--- a/lib/Travel/Status/DE/DBRIS/Journey.pm
+++ b/lib/Travel/Status/DE/DBRIS/Journey.pm
@@ -93,7 +93,14 @@ sub new {
# Number is either train no (ICE, RE) or line no (S, U, Bus, ...)
# with no way of distinguishing between those
if ( $ref->{trip} ) {
- $ref->{number} = ( split( qr{\s+}, $ref->{trip} ) )[-1];
+ my @trip_parts = split( qr{\s+}, $ref->{trip} );
+ if ( not defined $ref->{type} ) {
+ $ref->{type} = $trip_parts[0];
+ }
+ $ref->{number} = $trip_parts[-1];
+ if ( not defined $ref->{trip_no} ) {
+ $ref->{trip_no} = $ref->{number};
+ }
}
# For some trips, the type also contains the trip number like "MEX19161"
@@ -234,6 +241,12 @@ sub operators {
return @{ $self->{operators} // [] };
}
+sub types {
+ my ($self) = @_;
+
+ return @{ $self->{types} // [] };
+}
+
sub trip_numbers {
my ($self) = @_;