File Coverage

blib/lib/Thunderhorse/Config.pm
Criterion Covered Total %
statement 22 22 100.0
branch 4 4 100.0
condition 2 3 66.6
subroutine 4 4 100.0
pod 1 1 100.0
total 33 34 97.0


line stmt bran cond sub pod time code
1             package Thunderhorse::Config;
2             $Thunderhorse::Config::VERSION = '0.102';
3 21     21   194252 use v5.40;
  21         84  
4 21     21   615 use Mooish::Base -standard;
  21         68582  
  21         258  
5              
6 21     21   630081 use Path::Tiny qw(path);
  21         536195  
  21         7946  
7              
8             extends 'Gears::Config';
9              
10 6         10 sub load_from_files ($self, $conf_dir, $env = undef)
  6         13  
11 6     6 1 24390 {
  6         9  
  6         8  
12 6         21 $conf_dir = path($conf_dir);
13 6 100       252 return unless -d $conf_dir;
14              
15 5         199 my @extensions = map { $_->handled_extensions } $self->readers->@*;
  7         40  
16              
17 5   66     67 foreach my $base_name ('config', $env // ()) {
18 9         5265 foreach my $ext (@extensions) {
19 12         4285 my $file = $conf_dir->child("$base_name.$ext");
20 12 100       525 $self->add(file => "$file")
21             if -f $file;
22             }
23             }
24              
25 5         3522 return;
26             }
27              
28             __END__