File Coverage

blib/lib/Finance/TW/TAIFEX/Settlement/ThirdWednesday.pm
Criterion Covered Total %
statement 9 9 100.0
branch 1 2 50.0
condition n/a
subroutine 3 3 100.0
pod 0 1 0.0
total 13 15 86.6


line stmt bran cond sub pod time code
1             package Finance::TW::TAIFEX::Settlement::ThirdWednesday;
2 1     1   1275 use strict;
  1         2  
  1         53  
3 1     1   7 use Any::Moose 'Role';
  1         3  
  1         10  
4              
5             sub default_settlement_day {
6 6     6 0 13 my ($self, $date) = @_;
7              
8 6         28 my $first_day = $date->clone->truncate(to => 'month');
9              
10 6 50       2054 return $first_day->add
11             (weeks => $first_day->day_of_week > 3 ? 3 : 2,
12             days => 3 - $first_day->day_of_week,
13             );
14             }
15              
16             1;
17              
18             =head1 NAME
19              
20             Finance::TW::TAIFEX::Settlement::ThirdWednesday - settlement role
21              
22             =cut