diff options
author | Daniel Friesel <derf@finalrewind.org> | 2018-11-25 16:14:01 +0100 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2018-11-25 16:14:01 +0100 |
commit | 481d3f9c20b7d4239b3b09499bec2c63e31bae93 (patch) | |
tree | 363ff13b6e05222d6b825b5bc3ff26b92905c763 /lib/Travel/Status/DE/DBWagenreihung | |
parent | acaf6fec0ea994e2901ebffbdd4bd3f5b46c77d6 (diff) |
Add train classes
Diffstat (limited to 'lib/Travel/Status/DE/DBWagenreihung')
-rw-r--r-- | lib/Travel/Status/DE/DBWagenreihung/Wagon.pm | 38 |
1 files changed, 36 insertions, 2 deletions
diff --git a/lib/Travel/Status/DE/DBWagenreihung/Wagon.pm b/lib/Travel/Status/DE/DBWagenreihung/Wagon.pm index f3569c3..a29d42a 100644 --- a/lib/Travel/Status/DE/DBWagenreihung/Wagon.pm +++ b/lib/Travel/Status/DE/DBWagenreihung/Wagon.pm @@ -8,22 +8,56 @@ use utf8; use parent 'Class::Accessor'; use Carp qw(cluck); -our $VERSION = '1.21'; +our $VERSION = '0.00'; Travel::Status::DE::DBWagenreihung::Wagon->mk_ro_accessors( - qw(number section) + qw(class_type has_bistro number section) ); sub new { my ( $obj, %opt ) = @_; my $ref = \%opt; + $ref->{class_type} = 0; + $ref->{has_bistro} = 0; $ref->{number} = $ref->{wagenordnungsnummer}; $ref->{section} = $ref->{fahrzeugsektor}; + if ($ref->{kategorie} =~ m{SPEISEWAGEN}) { + $ref->{has_bistro} = 1; + } + + if ($ref->{fahrzeugtyp} =~ m{^AB}) { + $ref->{class_type} = 12; + } + elsif ($ref->{fahrzeugtyp} =~ m{^A}) { + $ref->{class_type} = 1; + } + elsif ($ref->{fahrzeugtyp} =~ m{^B|^WR}) { + $ref->{class_type} = 2; + } + return bless( $ref, $obj ); } +sub is_first_class { + my ($self) = @_; + + if ($self->{fahrzeugtyp} =~ m{^A}) { + return 1; + } + return 0; +} + +sub is_second_class { + my ($self) = @_; + + if ($self->{fahrzeugtyp} =~ m{^A?B}) { + return 1; + } + return 0; +} + sub sections { my ($self) = @_; |