summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2015-05-07 21:55:42 +0200
committerDaniel Friesel <derf@finalrewind.org>2015-05-07 21:55:42 +0200
commita58a9a6c73057275e1b05e4196110864d6146e51 (patch)
tree277a3988266c4aa5fe8b6ec842a3f8a2fae330d5
parent39c390518b75cd191aaeec3eadbffdf394c5d593 (diff)
Result: Add is_cancelled accessor
-rw-r--r--Changelog4
-rw-r--r--lib/Travel/Status/DE/DeutscheBahn/Result.pm14
2 files changed, 18 insertions, 0 deletions
diff --git a/Changelog b/Changelog
index e01e0f9..5ba53e6 100644
--- a/Changelog
+++ b/Changelog
@@ -1,3 +1,7 @@
+git HEAD
+
+ * Result: Add is_cancelled accessor
+
Travel::Status::DE::DeutscheBahn 1.04 - Sun May 03 2015
* Result: Add type accessor
diff --git a/lib/Travel/Status/DE/DeutscheBahn/Result.pm b/lib/Travel/Status/DE/DeutscheBahn/Result.pm
index ca61194..6eb7450 100644
--- a/lib/Travel/Status/DE/DeutscheBahn/Result.pm
+++ b/lib/Travel/Status/DE/DeutscheBahn/Result.pm
@@ -62,6 +62,16 @@ sub delay {
return;
}
+sub is_cancelled {
+ my ($self) = @_;
+ my $info = $self->info_raw;
+
+ if ( $info =~ m{ Fahrt \s f.llt \s aus }ox ) {
+ return 1;
+ }
+ return 0;
+}
+
sub origin {
my ($self) = @_;
@@ -207,6 +217,10 @@ Returns the train's delay in minutes, or undef if it is unknown.
Returns additional information, for instance the reason why the train is
delayed. May be an empty string if no (useful) information is available.
+=item $result->is_cancelled
+
+True if the train was cancelled, false otherwise.
+
=item $result->line
=item $result->train