Skip to content

Commit 8db2bcb

Browse files
authored
change else-if to given/when switch
1 parent 00d9833 commit 8db2bcb

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

lib/Pod/Convenience.pm6

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,17 @@ sub pod-gist(Pod::Block $pod, $level = 0) is export {
1111
}
1212
}
1313
@chunks = $leading, $pod.^name, (%confs.perl if %confs), "\n";
14-
for $pod.contents.list -> $c {
15-
if $c ~~ Pod::Block {
16-
@chunks.append: pod-gist($c, $level + 2);
17-
}
18-
elsif $c ~~ Str {
19-
@chunks.append: $c.indent($level + 2), "\n";
20-
} elsif $c ~~ Positional {
21-
@chunks.append: $c.map: {
22-
if $_ ~~ Pod::Block {
23-
*.&pod-gist
24-
} elsif $_ ~~ Str {
25-
$_
14+
for $pod.contents.list -> $contents {
15+
given $contents {
16+
when Pod::Block { @chunks.append: pod-gist($_, $level + 2); }
17+
when Str { @chunks.append: $_.indent($level + 2), "\n"; }
18+
when Positional {
19+
@chunks.append: $_.map: -> $content {
20+
if $content ~~ Pod::Block {
21+
*.&pod-gist
22+
} elsif $content ~~ Str {
23+
$content
24+
}
2625
}
2726
}
2827
}

0 commit comments

Comments
 (0)