Skip to content

Commit 4b5dfcc

Browse files
committed
Docs: Copyedit function doc strings
This commit makes several minor consistency and wording edits to the doc strings of the stdlib functions.
1 parent 400b91a commit 4b5dfcc

File tree

7 files changed

+30
-35
lines changed

7 files changed

+30
-35
lines changed

lib/puppet/parser/functions/getvar.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,13 @@ module Puppet::Parser::Functions
66
For example:
77
88
$foo = getvar('site::data::foo')
9+
# Equivalent to $foo = $site::data::foo
910
1011
This is useful if the namespace itself is stored in a string:
1112
13+
$datalocation = 'site::data'
1214
$bar = getvar("${datalocation}::bar")
15+
# Equivalent to $bar = $site::data::bar
1316
ENDHEREDOC
1417

1518
unless args.length == 1

lib/puppet/parser/functions/loadyaml.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
module Puppet::Parser::Functions
22

33
newfunction(:loadyaml, :type => :rvalue, :doc => <<-'ENDHEREDOC') do |args|
4-
Load a YAML file and return the data if it contains an Array, String, or Hash
5-
as a Puppet variable.
4+
Load a YAML file containing an array, string, or hash, and return the data
5+
in the corresponding native data type.
66
77
For example:
88

lib/puppet/parser/functions/validate_array.rb

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
11
module Puppet::Parser::Functions
22

33
newfunction(:validate_array, :doc => <<-'ENDHEREDOC') do |args|
4-
Validate all passed values are a Array data structure
5-
value does not pass the check.
4+
Validate that all passed values are array data structures. Abort catalog
5+
compilation if any value fails this check.
66
7-
Example:
8-
9-
These values validate
7+
The following values will pass:
108
119
$my_array = [ 'one', 'two' ]
1210
validate_array($my_array)
1311
14-
These values do NOT validate
12+
The following values will fail, causing compilation to abort:
1513
1614
validate_array(true)
1715
validate_array('some_string')

lib/puppet/parser/functions/validate_bool.rb

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
11
module Puppet::Parser::Functions
22

33
newfunction(:validate_bool, :doc => <<-'ENDHEREDOC') do |args|
4-
Validate all passed values are true or false. Abort catalog compilation if the
5-
value does not pass the check.
4+
Validate that all passed values are either true or false. Abort catalog
5+
compilation if any value fails this check.
66
7-
Example:
8-
9-
These booleans validate
7+
The following values will pass:
108
119
$iamtrue = true
1210
validate_bool(true)
1311
validate_bool(true, true, false, $iamtrue)
1412
15-
These strings do NOT validate and will abort catalog compilation
13+
The following values will fail, causing compilation to abort:
1614
1715
$some_array = [ true ]
1816
validate_bool("false")

lib/puppet/parser/functions/validate_hash.rb

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
11
module Puppet::Parser::Functions
22

33
newfunction(:validate_hash, :doc => <<-'ENDHEREDOC') do |args|
4-
Validate all passed values are a Hash data structure
5-
value does not pass the check.
4+
Validate that all passed values are hash data structures. Abort catalog
5+
compilation if any value fails this check.
66
7-
Example:
8-
9-
These values validate
7+
The following values will pass:
108
119
$my_hash = { 'one' => 'two' }
1210
validate_hash($my_hash)
1311
14-
These values do NOT validate
12+
The following values will fail, causing compilation to abort:
1513
1614
validate_hash(true)
1715
validate_hash('some_string')

lib/puppet/parser/functions/validate_re.rb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
module Puppet::Parser::Functions
22

33
newfunction(:validate_re, :doc => <<-'ENDHEREDOC') do |args|
4-
Perform simple validation of a string against a regular expression. The second
5-
argument of the function should be a string regular expression (without the //'s)
6-
or an array of regular expressions. If none of the regular expressions in the array
7-
match the string passed in, then an exception will be raised.
4+
Perform simple validation of a string against one or more regular
5+
expressions. The first argument of this function should be a string to
6+
test, and the second argument should be a stringified regular expression
7+
(without the // delimiters) or an array of regular expressions. If none
8+
of the regular expressions match the string passed in, compilation will
9+
abort with a parse error.
810
9-
Example:
10-
11-
These strings validate against the regular expressions
11+
The following strings will validate against the regular expressions:
1212
1313
validate_re('one', '^one$')
1414
validate_re('one', [ '^one', '^two' ])
1515
16-
These strings do NOT validate
16+
The following strings will fail to validate, causing compilation to abort:
1717
1818
validate_re('one', [ '^two', '^three' ])
1919

lib/puppet/parser/functions/validate_string.rb

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
11
module Puppet::Parser::Functions
22

33
newfunction(:validate_string, :doc => <<-'ENDHEREDOC') do |args|
4-
Validate all passed values are a string data structure
5-
value does not pass the check.
4+
Validate that all passed values are string data structures. Abort catalog
5+
compilation if any value fails this check.
66
7-
Example:
8-
9-
These values validate
7+
The following values will pass:
108
119
$my_string = "one two"
12-
validate_string($my_string)
10+
validate_string($my_string, 'three')
1311
14-
These values do NOT validate
12+
The following values will fail, causing compilation to abort:
1513
1614
validate_string(true)
1715
validate_string([ 'some', 'array' ])

0 commit comments

Comments
 (0)