From 2a0fe74619afb9b5c40d301a12b6167f5e4608d6 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sun, 22 Dec 2013 15:20:53 +0100 Subject: Result->route_timetable: Return a list --- bin/aseag-m | 4 ++-- lib/Travel/Status/DE/URA/Result.pm | 12 +++++++++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/bin/aseag-m b/bin/aseag-m index 34db950..e2c4111 100755 --- a/bin/aseag-m +++ b/bin/aseag-m @@ -134,7 +134,7 @@ sub show_results { ), $_->[1] ) - } @{ $d->route_timetable } + } $d->route_timetable ) ] ); @@ -152,7 +152,7 @@ sub show_results { sprintf( '%s %s', $_->[0]->strftime($strftime_format), $_->[1] ) - } @{ $d->route_timetable } + } $d->route_timetable ) ] ); diff --git a/lib/Travel/Status/DE/URA/Result.pm b/lib/Travel/Status/DE/URA/Result.pm index f8eddcd..938cba2 100644 --- a/lib/Travel/Status/DE/URA/Result.pm +++ b/lib/Travel/Status/DE/URA/Result.pm @@ -10,7 +10,7 @@ our $VERSION = '0.00'; Travel::Status::DE::URA::Result->mk_ro_accessors( qw(countdown countdown_sec date datetime destination line line_id - route_timetable stop stop_id time) + stop stop_id time) ); sub new { @@ -21,6 +21,12 @@ sub new { return bless( $ref, $obj ); } +sub route_timetable { + my ($self) = @_; + + return @{ $self->{route_timetable} }; +} + sub TO_JSON { my ($self) = @_; @@ -96,10 +102,10 @@ The number of the line. If the B method of Travel::Status::DE::URA(3pm) was called with B => true: -Returns an arrayref of arrayrefs describing the entire route. I.e. +Returns a list of arrayrefs describing the entire route. I.e. C<< [[$time1, $stop1], [$time2, $stop2], ...] >>. The times are DateTime::Duration(3pm) objects, the stops are only names, -not IDs (subject to change). Returns an empty arrayref otherwise. +not IDs (subject to change). Returns an empty list otherwise. =item $departure->stop -- cgit v1.2.3