File Coverage

lib/Finance/Bank/SentinelBenefits/Csv401kConverter/SideReverser.pm
Criterion Covered Total %
statement 20 20 100.0
branch 4 4 100.0
condition n/a
subroutine 6 6 100.0
pod 1 1 100.0
total 31 31 100.0


line stmt bran cond sub pod time code
1             package Finance::Bank::SentinelBenefits::Csv401kConverter::SideReverser;
2             $Finance::Bank::SentinelBenefits::Csv401kConverter::SideReverser::VERSION = '1.3';
3 6     6   1654 use Modern::Perl '2015';
  6         14  
  6         57  
4 6     6   1671 use feature 'signatures';
  6         15  
  6         214  
5              
6             =head1 NAME
7              
8              
9              
10             Finance::Bank::SentinelBenefits::Csv401kConverter::SideReverser - Reveses sides on lines
11              
12              
13              
14             =head1 VERSION
15              
16             version 1.3
17              
18             =head1 SYNOPSIS
19              
20              
21              
22             my $reverser = Finance::Bank::SentinelBenefits::Csv401kConverter::SideReverser->new();
23              
24              
25              
26             my $side = $reverser->flip('Buy');
27              
28              
29              
30             #$side eq 'Sell'
31              
32              
33              
34             This class represents one transaction, whether a contribution or
35             a company match, and tells you the security, the price, quantity,
36             total money, etc. It doesn't have any smarts, but serves as an
37             immutable internal data structure.
38              
39              
40              
41             =cut
42              
43 6     6   1216 use Moose;
  6         954263  
  6         41  
44              
45 6     6   44589 use Finance::Bank::SentinelBenefits::Csv401kConverter::Types;
  6         17  
  6         1016  
46              
47             =head1 METHODS
48              
49             =head2 p->flip($side)
50              
51             Turns buys into sells, dividends into shorts, etc
52              
53             =cut
54              
55 12     12 1 30 sub flip($self, $side){
  12         25  
  12         21  
  12         19  
56              
57             # $line->side() eq 'Buy' ? 'ShtSell' : 'Buy'
58              
59 12 100       207 return $side eq 'Buy' ? 'ShtSell'
    100          
60             : $side eq 'ReinvDiv' ? 'ShtSell'
61             : 'Buy';
62             }
63              
64 6     6   51 no Moose;
  6         16  
  6         49  
65              
66             __PACKAGE__->meta->make_immutable;
67              
68              
69             =head1 LICENSE AND COPYRIGHT
70              
71             Copyright 2009-2023 David Solimano
72             This file is part of Finance::Bank::SentinelBenefits::Csv401kConverter
73              
74             Finance::Bank::SentinelBenefits::Csv401kConverter is free software: you can redistribute it and/or modify
75             it under the terms of the GNU General Public License as published by
76             the Free Software Foundation, either version 3 of the License, or
77             (at your option) any later version.
78              
79             Finance::Bank::SentinelBenefits::Csv401kConverter is distributed in the hope that it will be useful,
80             but WITHOUT ANY WARRANTY; without even the implied warranty of
81             MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
82             GNU General Public License for more details.
83              
84             You should have received a copy of the GNU General Public License
85             along with Finance::Bank::SentinelBenefits::Csv401kConverter. If not, see <http://www.gnu.org/licenses/>.
86              
87             =cut