blib/lib/Dallycot/AST/Reciprocal.pm

filter: Statementstmt 84.0% 21 / 25 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 77.7% 7 / 9 Podpod 0.0% 0 / 3 totaltotal 75.6% 28 / 37 CC 1 SCAR 2.0
CC
1
Cov
84%
to_string
2.0
to_rdf
2.0
BEGIN
1.0
CRAP 1.2
« blib/lib/Dallycot/AST/JSONArray.pm ↑ Summary blib/lib/Dallycot/AST/TypePromotion.pm »
1 package Dallycot::AST::Reciprocal;
2 29 our $AUTHORITY = 'cpan:JSMITH';
3  
4 # ABSTRACT: Calculates the reciprocal of a numeric value
5  
6 29 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 29 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 29 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 29 ▶use parent 'Dallycot::AST';
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 29 ▶use Readonly;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 29 Readonly my $NUMERIC => ['Numeric'];
15  
16 sub to_string {
17 0 ▶ my ($self) = @_;
Subroutine to_string: not called CC=1 SCAR=6.9
Pod undocumented
18  
19 0 return "1/(" . $self->[0]->to_string . ")";
20 }
21  
22 sub to_rdf {
23 0 ▶ my($self, $model) = @_;
Subroutine to_rdf: not called CC=1 SCAR=6.9
Pod undocumented
24  
25 0 return $model -> apply(
26 $model -> meta_uri('loc:reciprocal'),
27 [ $self->[0] ],
28 {}
29 );
30 # my $bnode = $model -> bnode;
31 # $model -> add_type($bnode, 'loc:Reciprocal');
32 # $model -> add_expression($self -> [0]);
33 # return $bnode;
34 }
35  
36 sub execute {
37 14 ▶ my ( $self, $engine ) = @_;
Subroutine execute: called CC=1 SCAR=0.0
Pod undocumented
38  
39 return $engine->execute( $self->[0], $NUMERIC )->then(
40 sub {
41 14 ▶ Dallycot::Value::Numeric->new( 1 / ( $_[0]->value ) );
Subroutine __ANON__: called CC=1 SCAR=0.0
42 }
43 14 );
44 }
45  
46 29 1;
« blib/lib/Dallycot/AST/JSONArray.pm ↑ Summary blib/lib/Dallycot/AST/TypePromotion.pm »