summaryrefslogtreecommitdiff
path: root/lib/Travel/Status/DE/DBWagenreihung/Wagon.pm
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2019-01-01 21:18:58 +0100
committerDaniel Friesel <derf@finalrewind.org>2019-01-01 21:18:58 +0100
commit59bf31e9c5224ab82f10e2bf787fdf2d8272387e (patch)
tree97f4bd3c1b015d788de6afb4ea543c19c322f495 /lib/Travel/Status/DE/DBWagenreihung/Wagon.pm
parentb066c8145dfb091f073d91ca1ed043847d0c390b (diff)
add has_compartments accessor
Diffstat (limited to 'lib/Travel/Status/DE/DBWagenreihung/Wagon.pm')
-rw-r--r--lib/Travel/Status/DE/DBWagenreihung/Wagon.pm51
1 files changed, 27 insertions, 24 deletions
diff --git a/lib/Travel/Status/DE/DBWagenreihung/Wagon.pm b/lib/Travel/Status/DE/DBWagenreihung/Wagon.pm
index 0f92500..a9aa6a4 100644
--- a/lib/Travel/Status/DE/DBWagenreihung/Wagon.pm
+++ b/lib/Travel/Status/DE/DBWagenreihung/Wagon.pm
@@ -11,9 +11,10 @@ use Carp qw(cluck);
our $VERSION = '0.00';
Travel::Status::DE::DBWagenreihung::Wagon->mk_ro_accessors(
- qw(attributes class_type has_ac has_accessibility has_bistro
- has_multipurpose is_dosto is_interregio is_locomotive is_powercar number
- section type));
+ qw(attributes class_type has_ac has_accessibility has_bistro has_compartments
+ has_multipurpose is_dosto is_interregio is_locomotive is_powercar number
+ section type)
+);
sub new {
my ( $obj, %opt ) = @_;
@@ -27,7 +28,7 @@ sub new {
$ref->{section} = $opt{fahrzeugsektor};
$ref->{type} = $opt{fahrzeugtyp};
- my $self = bless($ref, $obj);
+ my $self = bless( $ref, $obj );
$self->parse_type;
@@ -64,7 +65,7 @@ sub new {
sub attributes {
my ($self) = @_;
- return @{$self->{attributes} // []};
+ return @{ $self->{attributes} // [] };
}
sub parse_type {
@@ -73,46 +74,48 @@ sub parse_type {
my $type = $self->{type};
my @desc;
- # Thanks to <https://www.deutsche-reisezugwagen.de/lexikon/erklarung-der-gattungszeichen/>
+# Thanks to <https://www.deutsche-reisezugwagen.de/lexikon/erklarung-der-gattungszeichen/>
- if ($type =~ m{^D}) {
+ if ( $type =~ m{^D} ) {
$self->{is_dosto} = 1;
- push(@desc, 'Doppelstock');
+ push( @desc, 'Doppelstock' );
}
- if ($type =~ m{b}) {
+ if ( $type =~ m{b} ) {
$self->{has_accessibility} = 1;
- push(@desc, 'Behindertengerechte Ausstattung');
+ push( @desc, 'Behindertengerechte Ausstattung' );
}
- if ($type =~ m{d}) {
+ if ( $type =~ m{d} ) {
$self->{has_multipurpose} = 1;
- push(@desc, 'Mehrzweckraum');
+ push( @desc, 'Mehrzweckraum' );
}
- if ($type =~ m{f}) {
- push(@desc, 'Steuerabteil');
+ if ( $type =~ m{f} ) {
+ push( @desc, 'Steuerabteil' );
}
- if ($type =~ m{i}) {
+ if ( $type =~ m{i} ) {
$self->{is_interregio} = 1;
- push(@desc, 'Interregiowagen');
+ push( @desc, 'Interregiowagen' );
}
- if ($type =~ m{m}) {
+ if ( $type =~ m{m} ) {
+
# ?
}
- if ($type =~ m{p}) {
+ if ( $type =~ m{p} ) {
$self->{has_ac} = 1;
- push(@desc, 'klimatisiert');
- push(@desc, 'Großraum');
+ push( @desc, 'klimatisiert' );
+ push( @desc, 'Großraum' );
}
- if ($type =~ m{v}) {
- $self->{has_ac} = 1;
- push(@desc, 'klimatisiert');
- push(@desc, 'Abteilwagen');
+ if ( $type =~ m{v} ) {
+ $self->{has_ac} = 1;
+ $self->{has_compartments} = 1;
+ push( @desc, 'klimatisiert' );
+ push( @desc, 'Abteilwagen' );
}
$self->{attributes} = \@desc;