Puppet Function: mysql::strip_hash
- Defined in:
-
lib/puppet/functions/mysql/strip_hash.rb
- Function type:
- Ruby 4.x API
Summary
When given a hash this function strips out all blank entries.
Overview
mysql::strip_hash(Hash $hash) ⇒ Hash
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/puppet/functions/mysql/strip_hash.rb', line 6
Puppet::Functions.create_function(:'mysql::strip_hash') do
dispatch :strip_hash do
required_param 'Hash', :hash
return_type 'Hash'
end
def strip_hash(hash)
hash.reject { |_k, v| v == '' }.each do |_k, v|
v.reject! { |_ki, vi| vi == '' } if v.is_a?(Hash)
end
end
end
|