Unverified Commit 3fd3f93c authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

Wagon: add is_closed accessor

parent 1e4083c0
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -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,7 +154,7 @@ say "";
for my $wagon ( $wr->wagons ) {
	printf(
		"%3s: %3s %10s  %s\n",
		$wagon->number || '?',
		$wagon->is_closed ? 'X' : ( $wagon->number || '?' ),
		$wagon->model || '???',
		$wagon->type, join( q{  }, $wagon->attributes )
	);
+8 −3
Original line number Diff line number Diff line
@@ -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;
	}