Skip to content

Commit d2cb1e9

Browse files
kai-burghardtGabrielNagy
authored andcommitted
(docs) mark documentation examples as source code
The `|` (pipe character) in the examples given in `lib/puppet/functions.rb` are currently rendered in https://puppet.com/docs/puppet/latest/function.html#partition as _table_ _cell_ _dividers_, but it’s supposed to be Puppet source code.
1 parent 8e006af commit d2cb1e9

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lib/puppet/functions/partition.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,21 @@
55
Puppet::Functions.create_function(:partition) do
66
# @param collection A collection of things to partition.
77
# @example Partition array of empty strings, results in e.g. [[''], [b, c]]
8+
# ```puppet
89
# ['', b, c].partition |$s| { $s.empty }
10+
# ```
911
# @example Partition array of strings using index, results in e.g. [['', 'ab'], ['b']]
12+
# ```puppet
1013
# ['', b, ab].partition |$i, $s| { $i == 2 or $s.empty }
14+
# ```
1115
# @example Partition hash of strings by key-value pair, results in e.g. [[['b', []]], [['a', [1, 2]]]]
16+
# ```puppet
1217
# { a => [1, 2], b => [] }.partition |$kv| { $kv[1].empty }
18+
# ```
1319
# @example Partition hash of strings by key and value, results in e.g. [[['b', []]], [['a', [1, 2]]]]
20+
# ```puppet
1421
# { a => [1, 2], b => [] }.partition |$k, $v| { $v.empty }
22+
# ```
1523
dispatch :partition_1 do
1624
required_param 'Collection', :collection
1725
block_param 'Callable[1,1]', :block

0 commit comments

Comments
 (0)