Skip to content

Commit

Permalink
Item14237: Added inject() method
Browse files Browse the repository at this point in the history
Inserts new spec items at current position. Prepared for -expandable
support.
  • Loading branch information
vrurg committed May 25, 2017
1 parent a1ea9a0 commit 1e2ee3b
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions core/lib/Foswiki/Config/SpecDef.pm
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ sub hasNext {
Returns undef if element is ok to be used as a subspec. Otherwise returns
error text about elem type suitable to be used in a error message.
=cut

sub badSubSpecElem {
Expand Down Expand Up @@ -230,6 +231,18 @@ sub subSpecs {
return $subSpecs;
}

sub inject {
my $this = shift;
my %params = @_;

return undef
unless defined $params{specDef} && ref( $params{specDef} ) eq 'ARRAY';

splice( @{ $this->specDef }, $this->cursor, 0, @{ $params{specDef} } );

return 1;
}

1;
__END__
Foswiki - The Free and Open Source Wiki, http://foswiki.org/
Expand Down

0 comments on commit 1e2ee3b

Please sign in to comment.