Skip to content

Commit c83c720

Browse files
committed
Add/modify Strings-style documentation
1 parent 7f7fd5b commit c83c720

File tree

8 files changed

+54
-35
lines changed

8 files changed

+54
-35
lines changed

Diff for: lib/puppet/functions/mysql/deepmerge.rb

+11-11
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
# Recursively merges two or more hashes together and returns the resulting hash.
2-
# For example:
1+
# @summary Recursively merges two or more hashes together and returns the resulting hash.
32
#
4-
# $hash1 = {'one' => 1, 'two' => 2, 'three' => { 'four' => 4 } }
5-
# $hash2 = {'two' => 'dos', 'three' => { 'five' => 5 } }
6-
# $merged_hash = mysql::deepmerge($hash1, $hash2)
7-
# # The resulting hash is equivalent to:
8-
# # $merged_hash = { 'one' => 1, 'two' => 'dos', 'three' => { 'four' => 4, 'five' => 5 } }
3+
# @example
4+
# $hash1 = {'one' => 1, 'two' => 2, 'three' => { 'four' => 4 } }
5+
# $hash2 = {'two' => 'dos', 'three' => { 'five' => 5 } }
6+
# $merged_hash = mysql_deepmerge($hash1, $hash2)
7+
# # The resulting hash is equivalent to:
8+
# # $merged_hash = { 'one' => 1, 'two' => 'dos', 'three' => { 'four' => 4, 'five' => 5 } }
9+
#
10+
# - When there is a duplicate key that is a hash, they are recursively merged.
11+
# - When there is a duplicate key that is not a hash, the key in the rightmost hash will "win."
12+
# - When there are conficting uses of dashes and underscores in two keys (which mysql would otherwise equate), the rightmost style will win.
913
#
10-
# When there is a duplicate key that is a hash, they are recursively merged.
11-
# When there is a duplicate key that is not a hash, the key in the rightmost hash will "win."
12-
# When there are conficting uses of dashes and underscores in two keys (which mysql would otherwise equate),
13-
# the rightmost style will win.
1414
Puppet::Functions.create_function(:'mysql::deepmerge') do
1515
def deepmerge(*args)
1616
if args.length < 2

Diff for: lib/puppet/functions/mysql/dirname.rb

+9-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
1-
# Returns the dirname of a path.
1+
# @summary
2+
# Returns the dirname of a path
3+
#
24
Puppet::Functions.create_function(:'mysql::dirname') do
5+
# @param path
6+
# Path to find the dirname for.
7+
#
8+
# @return
9+
# Directory name of path.
10+
#
311
dispatch :dirname do
412
required_param 'Variant[String, Undef]', :path
513
return_type 'String'

Diff for: lib/puppet/functions/mysql/password.rb

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
require 'digest/sha1'
2-
# Returns the mysql password hash from the clear text password.
3-
# Hash a string as mysql's "PASSWORD()" function would do it
2+
# @summary
3+
# Hash a string as mysql's "PASSWORD()" function would do it
4+
#
45
Puppet::Functions.create_function(:'mysql::password') do
6+
# @param password
7+
# Plain text password.
8+
#
9+
# @return the mysql password hash from the clear text password.
10+
#
511
dispatch :password do
612
required_param 'String', :password
713
return_type 'String'

Diff for: lib/puppet/functions/mysql/strip_hash.rb

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
1-
# When given a hash this function strips out all blank entries.
1+
# @summary
2+
# When given a hash this function strips out all blank entries.
3+
#
24
Puppet::Functions.create_function(:'mysql::strip_hash') do
5+
# @param hash
6+
# Hash to be stripped
7+
#
38
dispatch :strip_hash do
49
required_param 'Hash', :hash
510
return_type 'Hash'

Diff for: lib/puppet/parser/functions/mysql_deepmerge.rb

+6-9
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,22 @@
1-
# Recursively merges two or more hashes together and returns the resulting hash.
21
module Puppet::Parser::Functions
32
newfunction(:mysql_deepmerge, type: :rvalue, doc: <<-'ENDHEREDOC') do |args|
4-
Recursively merges two or more hashes together and returns the resulting hash.
5-
6-
For example:
3+
@summary Recursively merges two or more hashes together and returns the resulting hash.
74
5+
@example
86
$hash1 = {'one' => 1, 'two' => 2, 'three' => { 'four' => 4 } }
97
$hash2 = {'two' => 'dos', 'three' => { 'five' => 5 } }
108
$merged_hash = mysql_deepmerge($hash1, $hash2)
119
# The resulting hash is equivalent to:
1210
# $merged_hash = { 'one' => 1, 'two' => 'dos', 'three' => { 'four' => 4, 'five' => 5 } }
1311
14-
When there is a duplicate key that is a hash, they are recursively merged.
15-
When there is a duplicate key that is not a hash, the key in the rightmost hash will "win."
16-
When there are conficting uses of dashes and underscores in two keys (which mysql would otherwise equate),
12+
- When there is a duplicate key that is a hash, they are recursively merged.
13+
- When there is a duplicate key that is not a hash, the key in the rightmost hash will "win."
14+
- When there are conficting uses of dashes and underscores in two keys (which mysql would otherwise equate),
1715
the rightmost style will win.
1816
17+
@return [Hash]
1918
ENDHEREDOC
2019

21-
warning('Deprecation: mysql_deepmerge() is deprecated, please use mysql::deepmerge() instead.')
22-
2320
if args.length < 2
2421
raise Puppet::ParseError, _('mysql_deepmerge(): wrong number of arguments (%{args_length}; must be at least 2)') % { args_length: args.length }
2522
end

Diff for: lib/puppet/parser/functions/mysql_dirname.rb

+8-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
1-
# Returns the dirname of a path.
21
module Puppet::Parser::Functions
32
newfunction(:mysql_dirname, type: :rvalue, doc: <<-EOS
4-
Returns the dirname of a path.
3+
@summary
4+
Returns the dirname of a path
5+
6+
@param [String] path
7+
Path to find the dirname for.
8+
9+
@return [String]
10+
Directory name of path.
511
EOS
612
) do |arguments|
713

8-
warning('Deprecation: mysql_dirname() is deprecated, please use mysql::dirname() instead.')
9-
1014
if arguments.empty?
1115
raise Puppet::ParseError, _('mysql_dirname(): Wrong number of arguments given (%{args_length} for 1)') % { args_length: args.length }
1216
end

Diff for: lib/puppet/parser/functions/mysql_password.rb

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
require 'digest/sha1'
2-
# Returns the mysql password hash from the clear text password.
3-
# Hash a string as mysql's "PASSWORD()" function would do it
42
module Puppet::Parser::Functions
53
newfunction(:mysql_password, type: :rvalue, doc: <<-EOS
6-
Returns the mysql password hash from the clear text password.
4+
@summary
5+
Hash a string as mysql's "PASSWORD()" function would do it
6+
7+
@param [String] password Plain text password.
8+
9+
@return [String] the mysql password hash from the clear text password.
710
EOS
811
) do |args|
912

10-
warning('Deprecation: mysql_password() is deprecated, please use mysql::password() instead.')
11-
1213
if args.size != 1
1314
raise Puppet::ParseError, _('mysql_password(): Wrong number of arguments given (%{args_length} for 1)') % { args_length: args.length }
1415
end

Diff for: lib/puppet/parser/functions/mysql_strip_hash.rb

-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ module Puppet::Parser::Functions
66
EOS
77
) do |args|
88

9-
warning('Deprecation: mysql_strip_hash() is deprecated, please use mysql::strip_hash() instead.')
10-
119
hash = args[0]
1210
unless hash.is_a?(Hash)
1311
raise(Puppet::ParseError, _('mysql_strip_hash(): Requires a hash to work.'))

0 commit comments

Comments
 (0)