Metro/Graph/Segment.pm

filter: Statementstmt 89.2% 25 / 28 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 75.0% 6 / 8 Podpod 0.0% 0 / 1 totaltotal 83.7% 31 / 37 CC 1 SCAR 2.2
CC
1
Cov
89%
__ANON__
2.0
to_hash
2.0
BEGIN
1.0
CRAP 1.2
« Metro/Plugin/Hook/StreamStations.pm ↑ Summary Metro/Graph/Line.pm »
1 14 ▶use 5.10.0;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 14 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 14 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 package Map::Metro::Graph::Segment;
6  
7 # ABSTRACT: All lines between two neighboring stations
8 14 our $AUTHORITY = 'cpan:CSSON'; # AUTHORITY
9 14 our $VERSION = '0.2404';
10  
11 14 ▶use Map::Metro::Elk;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 14 ▶use Types::Standard qw/ArrayRef Str Bool/;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 14 ▶use Map::Metro::Types qw/Station/;
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 has line_ids => (
16 is => 'ro',
17 isa => ArrayRef[Str],
18 traits => ['Array'],
19 required => 1,
20 0 ▶ default => sub { [] },
Subroutine __ANON__: not called CC=1 SCAR=6.9
21 14 handles => {
22 all_line_ids => 'elements',
23 }
24 );
25 14 has origin_station => (
26 is => 'ro',
27 isa => Station,
28 required => 1,
29 );
30 14 has destination_station => (
31 is => 'ro',
32 isa => Station,
33 required => 1,
34 );
35 14 has is_one_way => (
36 is => 'ro',
37 isa => Bool,
38 default => 0,
39 );
40  
41 sub to_hash {
42 0 ▶ my $self = shift;
Subroutine to_hash: not called CC=1 SCAR=6.9
Pod undocumented
43  
44 return {
45 0 line_ids => [ $self->all_line_ids ],
46 origin_station => $self->origin_station->to_hash,
47 destination_station => $self->destination_station->to_hash,
48 is_one_way => $self->is_one_way,
49 };
50 }
51  
52 14 __PACKAGE__->meta->make_immutable;
53  
54 14 1;
55  
56 __END__
57  
58 =pod
59  
60 =encoding UTF-8
61  
62 =head1 NAME
63  
64 Map::Metro::Graph::Segment - All lines between two neighboring stations
65  
66 =head1 VERSION
67  
68 Version 0.2404, released 2016-04-30.
69  
70 =head1 DESCRIPTION
71  
72 Segments are used during the graph building phase. Its purpose is to describe the combination of two L<Stations|Map::Metro::Graph::Station>
73 and all L<Lines|Map::Metro::Graph::Line> that go between them.
74  
75 =head1 SOURCE
76  
77 L<https://github.com/Csson/p5-Map-Metro>
78  
79 =head1 HOMEPAGE
80  
81 L<https://metacpan.org/release/Map-Metro>
82  
83 =head1 AUTHOR
84  
85 Erik Carlsson <info@code301.com>
86  
87 =head1 COPYRIGHT AND LICENSE
88  
89 This software is copyright (c) 2016 by Erik Carlsson.
90  
91 This is free software; you can redistribute it and/or modify it under
92 the same terms as the Perl 5 programming language system itself.
93  
94 =cut
« Metro/Plugin/Hook/StreamStations.pm ↑ Summary Metro/Graph/Line.pm »