| 1 | package Valiant::Proxy::Hash; | ||||||||||
| 2 | |||||||||||
| 3 | 1 | ▶ | use Moo; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 1 | with 'Valiant::Proxy'; | |||||||||
| 5 | |||||||||||
| 6 | sub read_attribute_for_validation { | ||||||||||
| 7 | 27 | ▶ | my ($self, $attribute) = @_; | ||||||||
|
Subroutine
read_attribute_for_validation: called CC=2 SCAR=7.6
Pod
undocumented
| |||||||||||
| 8 | 27 | ▶ | if(exists $self->for->{$attribute}) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 9 | 27 | return $self->for->{$attribute}; | |||||||||
| 10 | } else { | ||||||||||
| 11 | 0 | return undef; # TODO Might need a flag to allow die here? | |||||||||
| 12 | } | ||||||||||
| 13 | } | ||||||||||
| 14 | |||||||||||
| 15 | 0 | ▶ | sub keys { return keys %{ $_[0]->for } } | ||||||||
|
Subroutine
keys: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 16 | 0 | ▶ | sub values { return map { $_[0]->for->{$_} } $_[0]->keys } | ||||||||
|
Subroutine
values: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 17 | |||||||||||
| 18 | 1 | 1; | |||||||||
| 19 | |||||||||||
| 20 | =head1 NAME | ||||||||||
| 21 | |||||||||||
| 22 | Valiant::Result::Hash - Wrap a hashref in a result object for validation. | ||||||||||
| 23 | |||||||||||
| 24 | =head1 SYNOPSIS | ||||||||||
| 25 | |||||||||||
| 26 | TBD | ||||||||||
| 27 | |||||||||||
| 28 | =head1 DESCRIPTION | ||||||||||
| 29 | |||||||||||
| 30 | Allows you to run validations against a HashRef. | ||||||||||
| 31 | |||||||||||
| 32 | You probably won't use this directly (although you can) since we have L<Valiant::Class> to | ||||||||||
| 33 | encapsulate the most common patterns for this need. | ||||||||||
| 34 | |||||||||||
| 35 | =head1 SEE ALSO | ||||||||||
| 36 | |||||||||||
| 37 | This does the interface defined by L<Valiant::Proxy> so see the docs on that. | ||||||||||
| 38 | |||||||||||
| 39 | Also: L<Valiant>, L<Valiant::Validator>, L<Valiant::Validator::Each>. | ||||||||||
| 40 | |||||||||||
| 41 | =head1 AUTHOR | ||||||||||
| 42 | |||||||||||
| 43 | See L<Valiant> | ||||||||||
| 44 | |||||||||||
| 45 | =head1 COPYRIGHT & LICENSE | ||||||||||
| 46 | |||||||||||
| 47 | See L<Valiant> | ||||||||||
| 48 | |||||||||||
| 49 | =cut | ||||||||||