File Coverage

blib/lib/Dallycot/AST/Negation.pm
Criterion Covered Total %
statement 12 19 63.1
branch n/a
condition n/a
subroutine 4 8 50.0
pod 0 3 0.0
total 16 30 53.3


line stmt bran cond sub pod time code
1             package Dallycot::AST::Negation;
2             our $AUTHORITY = 'cpan:JSMITH';
3              
4             # ABSTRACT: Negate a numeric value
5              
6 23     23   12101 use strict;
  23         38  
  23         701  
7 23     23   90 use warnings;
  23         29  
  23         446  
8              
9 23     23   79 use utf8;
  23         31  
  23         91  
10 23     23   386 use parent 'Dallycot::AST';
  23         28  
  23         93  
11              
12             sub to_string {
13 0     0 0   my ($self) = @_;
14              
15 0           return "-" . $self->[0]->to_string;
16             }
17              
18             sub to_rdf {
19 0     0 0   my($self, $model) = @_;
20              
21 0           return $model -> apply(
22             $model -> meta_uri('loc:negate'),
23             [ $self->[0] ],
24             {}
25             );
26             # my $bnode = $model -> bnode;
27             # $model -> add_type($bnode, 'loc:Negation');
28             # $model -> add_expression($self -> [0]);
29             # return $bnode;
30             }
31              
32             sub execute {
33 0     0 0   my ( $self, $engine ) = @_;
34              
35             return $engine->execute( $self->[0], ['Numeric'] )->then(
36             sub {
37 0     0     return $_[0] -> negated;
38             }
39 0           );
40             }
41              
42             1;