NAME
Test::Proto::Repeatable - represent a repeatable element or series in array validation
SYNOPSIS
pArray->contains_only(pRepeatable('a', 'b'));
# will validate ['a', 'b'] and ['a', 'b', 'a', 'b'] as true
Used in array validation to represent a sequence qhich must be present in its entirety. Can contain, or be contained by, a Test::Proto::Series or a Test::Proto::Alternation.
METHODS
new
Each argument is another element in the series. NB: A series is automatically created to hold all the contents.
contents
die unless exists $alternation->contents->[0];
A chainable getter/setter method for the contents of the series.
min
my $pRepeatable = pRepeatable('foo')->min(2);
my $min = $pRepeatable->min;
Sets and/or returns the minimum number of occurrences required.
max
my $pRepeatable = pRepeatable('foo')->max(2);
my $max = $pRepeatable->max;
Sets and/or returns the maximum number of occurrences permitted.