File Coverage

lib/Data/Pokemon/Go/Role/Types.pm
Criterion Covered Total %
statement 23 23 100.0
branch n/a
condition n/a
subroutine 8 8 100.0
pod n/a
total 31 31 100.0


line stmt bran cond sub pod time code
1             package Data::Pokemon::Go::Role::Types;
2 8     8   3414 use 5.008001;
  8         23  
3 8     8   43 use utf8;
  8         39  
  8         46  
4 8     8   3871 use Encode;
  8         66359  
  8         522  
5              
6 8     8   2786 use Moose::Role;
  8         31878  
  8         25  
7 8     8   36018 use Moose::Util::TypeConstraints;
  8         14  
  8         29  
8              
9             our @All = qw(
10             ノーマル かくとう どく じめん ひこう むし いわ
11             ゴースト はがね ほのお みず でんき くさ こおり
12             エスパー ドラゴン あく フェアリー
13             );
14              
15             enum 'Type' => \@All;
16             has types => ( is => 'rw', default => 'ノーマル', isa => 'Type' );
17              
18 8     8   15228 no Moose::Role;
  8         13  
  8         27  
19              
20             # initialize ==============================================================
21 8     8   2143 use YAML::XS;
  8         2097  
  8         365  
22 8     8   357 use File::Share 'dist_dir';
  8         17226  
  8         1628  
23             my $dir = dist_dir('Data-Pokemon-Go');
24              
25             our $Ref_Advantage = YAML::XS::LoadFile("$dir/Relations.yaml");
26             our $Relations = {};
27              
28             while( my( $type, $ref ) = each %$Ref_Advantage ){
29             while( my( $relation, $values ) = each %$ref ){
30             next unless ref $values;
31             foreach my $value (@$values){
32             push @{$Relations->{$value}{invalid}}, $type if $relation eq 'invalid';
33             unshift @{$Relations->{$value}{invalid}}, $type if $relation eq 'void';
34             push @{$Relations->{$value}{effective}}, $type if $relation eq 'effective';
35             }
36             }
37             }
38              
39             1;
40             __END__
41              
42             =encoding utf-8
43              
44             =head1 NAME
45              
46             Data::Pokemon::Go::Role::Types - It's new $module
47              
48             =head1 SYNOPSIS
49              
50             use Data::Pokemon::Go::Role::Types;
51              
52             =head1 DESCRIPTION
53              
54             Data::Pokemon::Go::Role::Types is ...
55              
56             =head1 LICENSE
57              
58             Copyright (C) Yuki Yoshida.
59              
60             This library is free software; you can redistribute it and/or modify
61             it under the same terms as Perl itself.
62              
63             =head1 AUTHOR
64              
65             Yuki Yoshida E<lt>worthmine@gmail.comE<gt>
66              
67             =cut
68