58 |
58 |
@text_blocks = grep { $_->output_position == $params{output_position} } @text_blocks if exists $params{output_position};
|
59 |
59 |
@text_blocks = sort { $a->position <=> $b->position } @text_blocks;
|
60 |
60 |
|
61 |
|
return wantarray ? @text_blocks : \@text_blocks;
|
|
61 |
return \@text_blocks;
|
62 |
62 |
}
|
63 |
63 |
|
64 |
64 |
sub sections_sorted {
|
... | ... | |
66 |
66 |
|
67 |
67 |
croak "This sub is not a writer" if @rest;
|
68 |
68 |
|
69 |
|
my @sections = sort { $a->position <=> $b->position } grep { !$_->parent_id } @{ $self->items };
|
70 |
|
return wantarray ? @sections : \@sections;
|
|
69 |
return [ sort { $a->position <=> $b->position } grep { !$_->parent_id } @{ $self->items } ];
|
71 |
70 |
}
|
72 |
71 |
|
73 |
72 |
sub sections { §ions_sorted; }
|
... | ... | |
85 |
84 |
@copies = grep { $_->version->version_number <= $params{max_version_number} } @copies if $params{max_version_number};
|
86 |
85 |
@copies = sort { $a->version->version_number <=> $b->version->version_number } @copies;
|
87 |
86 |
|
88 |
|
return wantarray ? @copies : \@copies;
|
|
87 |
return \@copies;
|
89 |
88 |
}
|
90 |
89 |
|
91 |
90 |
sub create_copy {
|
... | ... | |
405 |
404 |
|
406 |
405 |
=item C<sections_sorted>
|
407 |
406 |
|
408 |
|
Returns a list of requirement spec items that
|
|
407 |
Returns an array reference of requirement spec items that do not have
|
|
408 |
a parent -- meaning that are sections.
|
409 |
409 |
|
410 |
410 |
This is not a writer. Use the C<items> relationship for that.
|
411 |
411 |
|
412 |
412 |
=item C<text_blocks_sorted %params>
|
413 |
413 |
|
414 |
|
Returns an array (or an array reference depending on context) of text
|
415 |
|
blocks sorted by their positional column in ascending order. If the
|
416 |
|
C<output_position> parameter is given then only the text blocks
|
417 |
|
belonging to that C<output_position> are returned.
|
|
414 |
Returns an array reference of text blocks sorted by their positional
|
|
415 |
column in ascending order. If the C<output_position> parameter is
|
|
416 |
given then only the text blocks belonging to that C<output_position>
|
|
417 |
are returned.
|
418 |
418 |
|
419 |
419 |
=item C<validate>
|
420 |
420 |
|
... | ... | |
423 |
423 |
|
424 |
424 |
=item C<versioned_copies_sorted %params>
|
425 |
425 |
|
426 |
|
Returns an array (or an array reference depending on context) of
|
427 |
|
versioned copies sorted by their version number in ascending order. If
|
428 |
|
the C<max_version_number> parameter is given then only the versioned
|
429 |
|
copies whose version number is less than or equal to
|
430 |
|
C<max_version_number> are returned.
|
|
426 |
Returns an array reference of versioned copies sorted by their version
|
|
427 |
number in ascending order. If the C<max_version_number> parameter is
|
|
428 |
given then only the versioned copies whose version number is less than
|
|
429 |
or equal to C<max_version_number> are returned.
|
431 |
430 |
|
432 |
431 |
=back
|
433 |
432 |
|
RequirementSpec(Item): Arrays nur als Referenz zurückgeben
Innerhalb vom Template-Toolkit kann ansonsten Merkwürdiges
passieren. Weist man das Ergebnis einer Variablen zu, so geschieht
dies offensichtlich im Array-Kontext. Dadurch sind aber Tests mit
var.size plötzlich falsch...
[% SET blocks = rspec.text_blocks_sorted(output_position=0) ]
[ IF blocks.size %]
...greift auch, wenn keine Blöcke für diese Position existieren