File Coverage

lib/UR/BoolExpr/Template/PropertyComparison/GreaterThan.pm
Criterion Covered Total %
statement 17 17 100.0
branch 5 6 83.3
condition 2 3 66.6
subroutine 4 4 100.0
pod n/a
total 28 30 93.3


line stmt bran cond sub pod time code
1              
2             package UR::BoolExpr::Template::PropertyComparison::GreaterThan;
3              
4 10     10   454 use strict;
  10         16  
  10         313  
5 10     10   37 use warnings;
  10         12  
  10         1109  
6             require UR;
7             our $VERSION = "0.46"; # UR $VERSION;
8              
9             UR::Object::Type->define(
10             class_name => __PACKAGE__,
11             is => ['UR::BoolExpr::Template::PropertyComparison'],
12             );
13              
14             sub _compare {
15 37     37   54 my ($class,$comparison_value,@property_value) = @_;
16            
17 37         112 my $cv_is_number = Scalar::Util::looks_like_number($comparison_value);
18              
19 10     10   36 no warnings 'uninitialized';
  10         16  
  10         1107  
20 37         66 foreach my $property_value ( @property_value ) {
21 37         65 my $pv_is_number = Scalar::Util::looks_like_number($property_value);
22              
23 37 100 66     112 if ($cv_is_number and $pv_is_number) {
24 21 100       113 return 1 if ( $property_value > $comparison_value );
25             } else {
26 16 50       96 return 1 if ( $property_value gt $comparison_value );
27             }
28             }
29 1         5 return '';
30             }
31              
32              
33             1;
34              
35             =pod
36              
37             =head1 NAME
38              
39             UR::BoolExpr::Template::PropertyComparison::GreaterThan - perform a greater than test
40              
41             =head1 DESCRIPTION
42              
43             If the property returns multiple values, this comparison returns true if any of the values are
44             greater than the comparison value
45              
46             =cut