line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Valiemon::Attributes::MultipleOf; |
2
|
1
|
|
|
1
|
|
557
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
30
|
|
3
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
24
|
|
4
|
1
|
|
|
1
|
|
6
|
use utf8; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
4
|
|
5
|
1
|
|
|
1
|
|
25
|
use parent qw(Valiemon::Attributes); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
56
|
use Carp qw(croak); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
275
|
|
8
|
|
|
|
|
|
|
|
9
|
14
|
|
|
14
|
0
|
35
|
sub attr_name { 'multipleOf' } |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub is_valid { |
12
|
8
|
|
|
8
|
0
|
18
|
my ($class, $context, $schema, $data) = @_; |
13
|
|
|
|
|
|
|
|
14
|
8
|
100
|
|
|
|
25
|
return 1 unless $context->prims->is_number($data); # skip on non-number value |
15
|
|
|
|
|
|
|
|
16
|
7
|
|
|
|
|
20
|
my $attr_name = $class->attr_name(); |
17
|
7
|
|
|
|
|
15
|
my $multiple_of = $schema->{$attr_name}; |
18
|
|
|
|
|
|
|
$context->in_attr($class, sub { |
19
|
7
|
50
|
33
|
7
|
|
18
|
if (!$context->prims->is_number($multiple_of) || !(0 < $multiple_of)) { |
20
|
0
|
|
|
|
|
0
|
croak sprintf '`%s` must be a number. This number must be greater than 0 at %s', |
21
|
|
|
|
|
|
|
$attr_name, $context->position; |
22
|
|
|
|
|
|
|
} |
23
|
7
|
|
|
|
|
15
|
$context->prims->is_integer($data/$multiple_of); |
24
|
7
|
|
|
|
|
36
|
}); |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
1; |