TileMap/Tile.pm

filter: Statementstmt 100% 30 / 30 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 7 / 7 Podpod 0.0% 0 / 1 totaltotal 95.0% 38 / 40 CC 2 SCAR 2.2
CC
2
Cov
97%
BUILD
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.3
« TileMap/Role/Helpers.pm ↑ Summary
1 package Game::TileMap::Tile;
2 3 $Game::TileMap::Tile::VERSION = '1.000';
3 3 ▶use v5.10;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 3 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 3 ▶use Mooish::AttributeBuilder -standard;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 3 ▶use Carp qw(croak);
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 3 has param ['x', 'y'] => (
12  
13 # isa => PositiveInt,
14 );
15  
16 3 has param 'contents' => (
17 writer => 1,
18  
19 # isa => Any,
20 );
21  
22 3 has field 'is_wall' => (
23 writer => -hidden,
24  
25 # isa => Bool,
26 );
27  
28 3 has field 'is_void' => (
29 writer => -hidden,
30  
31 # isa => Bool,
32 );
33  
34 3 has field 'type' => (
35 writer => -hidden,
36  
37 # isa => Any,
38 );
39  
40 sub BUILD
41 {
42 186 ▶ my ($self, $args) = @_;
Subroutine BUILD: called CC=2 SCAR=7.0
Pod undocumented
43  
44 186 my $legend = $args->{legend};
45 186 ▶ croak "argument legend is required for Game::TileMap::Tile"
Branch: 1 branch
BranchTrueFalseTotal
unless $legend 0 186 186
46 unless $legend;
47  
48 186 $self->_set_type($self->contents);
49 186 $self->_set_is_void($legend->voids->{$self->type});
50 186 $self->_set_is_wall($legend->walls->{$self->type});
51 }
52  
53 3 1;
54  
55 __END__
« TileMap/Role/Helpers.pm ↑ Summary