lib/Finance/Bank/SentinelBenefits/Csv401kConverter/SideReverser.pm

filter: Statementstmt 100% 18 / 18 Branchbran 100% 4 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 6 / 6 Podpod 100% 1 / 1 totaltotal 100% 29 / 29 CC 3 SCAR 5.6
CC
3
Cov
100%
flip
3.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.8
« blib/lib/Finance/Bank/SentinelBenefits/example.pl ↑ Summary lib/Finance/Bank/SentinelBenefits/Csv401kConverter/QifWriter.pm »
1 package Finance::Bank::SentinelBenefits::Csv401kConverter::SideReverser;
2 6 $Finance::Bank::SentinelBenefits::Csv401kConverter::SideReverser::VERSION = '1.3';
3 6 ▶use Modern::Perl '2015';
Subroutine BEGIN: called CC=1 SCAR=0.0
4 6 ▶use feature 'signatures';
Subroutine BEGIN: called CC=1 SCAR=0.0
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 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
44  
45 6 ▶use Finance::Bank::SentinelBenefits::Csv401kConverter::Types;
Subroutine BEGIN: called CC=1 SCAR=0.0
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 ▶sub flip($self, $side){
Subroutine flip: called CC=3 SCAR=11.0
Pod documented
56  
57 # $line->side() eq 'Buy' ? 'ShtSell' : 'Buy'
58  
59 12 ▶ return $side eq 'Buy' ? 'ShtSell'
Branch: 2 branches
BranchTrueFalseTotal
$side eq 'Buy' ? : 4 8 12
$side eq 'ReinvDiv' ? : 2 6 8
60 : $side eq 'ReinvDiv' ? 'ShtSell'
61 : 'Buy';
62 }
63  
64 6 ▶no Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
65  
66 6 __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
« blib/lib/Finance/Bank/SentinelBenefits/example.pl ↑ Summary lib/Finance/Bank/SentinelBenefits/Csv401kConverter/QifWriter.pm »