File Coverage

lib/VANAMBURG/Suit.pm
Criterion Covered Total %
statement 1 3 33.3
branch n/a
condition n/a
subroutine 1 1 100.0
pod n/a
total 2 4 50.0


line stmt bran cond sub pod time code
1             package VANAMBURG::Suit;
2 1     1   24505 use Moose;
  0            
  0            
3              
4             =head1 VANAMBURG::Suit
5              
6             Represents the suit aspect of a card.
7              
8             =cut
9              
10             =head2 name
11              
12             The name of the card, such as "Jack", "Queen", "Two", etc.
13              
14             =cut
15              
16             has 'name' => ( isa => 'Str', is => 'ro', required => 1 );
17              
18             =head2 abbreviation
19              
20             A single character representation of the suit such as "H" for heard, etc.
21              
22             =cut
23              
24             has 'abbreviation' => ( isa => 'Str', is => 'ro', required => 1 );
25              
26             =head2 unicode_char
27              
28             A unicode represendation of the suit symbol.
29              
30             =cut
31              
32             has 'unicode_char' => ( isa => 'Str', is => 'ro', required => 1 );
33              
34             =head2 equals
35              
36             Returns true (1) if the name and abbreviation of this object are the
37             same as the suit passed as the parameter.
38              
39             =cut
40              
41             sub equals {
42             my ( $self, $other ) = @_;
43             return 0 if ( !defined $other );
44             if ( $self->name eq $other->name && $self->abbreviation eq $other->abbreviation ) {
45             return 1;
46             }
47             else {
48             return 0;
49             }
50             }
51              
52             1;