diff options
author | Birte Kristina Friesel <derf@finalrewind.org> | 2024-03-29 12:35:56 +0100 |
---|---|---|
committer | Birte Kristina Friesel <derf@finalrewind.org> | 2024-03-29 12:35:56 +0100 |
commit | 3fd3f93c92bc38650eb0653b5cf5c707a5dae747 (patch) | |
tree | 1361cb598c3adff157a7853eff23296032f9e862 | |
parent | 1e4083c05a5b317ddfa1232b76eb5eafc1d29e2b (diff) |
Wagon: add is_closed accessor
-rwxr-xr-x | bin/db-wagenreihung | 8 | ||||
-rw-r--r-- | lib/Travel/Status/DE/DBWagenreihung/Wagon.pm | 11 |
2 files changed, 14 insertions, 5 deletions
diff --git a/bin/db-wagenreihung b/bin/db-wagenreihung index 637044a..73bbdb4 100755 --- a/bin/db-wagenreihung +++ b/bin/db-wagenreihung @@ -116,6 +116,10 @@ for my $wagon ( $wr->wagons ) { my $wagon_desc = $wagon->number || '?'; + if ( $wagon->is_closed ) { + $wagon_desc = 'X'; + } + if ( $wagon->is_locomotive or $wagon->is_powercar ) { $wagon_desc = ' ■ '; } @@ -150,8 +154,8 @@ say ""; for my $wagon ( $wr->wagons ) { printf( "%3s: %3s %10s %s\n", - $wagon->number || '?', - $wagon->model || '???', + $wagon->is_closed ? 'X' : ( $wagon->number || '?' ), + $wagon->model || '???', $wagon->type, join( q{ }, $wagon->attributes ) ); } diff --git a/lib/Travel/Status/DE/DBWagenreihung/Wagon.pm b/lib/Travel/Status/DE/DBWagenreihung/Wagon.pm index eddf4b1..ffc3e58 100644 --- a/lib/Travel/Status/DE/DBWagenreihung/Wagon.pm +++ b/lib/Travel/Status/DE/DBWagenreihung/Wagon.pm @@ -12,9 +12,9 @@ our $VERSION = '0.11'; Travel::Status::DE::DBWagenreihung::Wagon->mk_ro_accessors( qw(attributes class_type group_index has_ac has_accessibility has_bahn_comfort has_bike_storage has_bistro has_compartments - has_family_area has_phone_area has_quiet_area is_dosto is_interregio - is_locomotive is_powercar number model multipurpose section train_no - train_subtype type uic_id) + has_family_area has_phone_area has_quiet_area is_closed is_dosto + is_interregio is_locomotive is_powercar number model multipurpose section + train_no train_subtype type uic_id) ); our %type_attributes = ( @@ -74,6 +74,7 @@ sub new { $ref->{has_bistro} = 0; $ref->{is_locomotive} = 0; $ref->{is_powercar} = 0; + $ref->{is_closed} = 0; $ref->{train_no} = $opt{train_no}; $ref->{number} = $opt{wagenordnungsnummer}; $ref->{model} = $opt{fahrzeugnummer}; @@ -87,6 +88,10 @@ sub new { $self->parse_type; + if ( $opt{status} and $opt{status} eq 'GESCHLOSSEN' ) { + $ref->{is_closed} = 1; + } + if ( $opt{kategorie} =~ m{SPEISEWAGEN} ) { $ref->{has_bistro} = 1; } |