diff options
author | David Schmitt <david.schmitt@puppetlabs.com> | 2015-09-28 17:11:10 +0100 |
---|---|---|
committer | David Schmitt <david.schmitt@puppetlabs.com> | 2015-09-28 17:11:10 +0100 |
commit | 76db98120acab12d5aab3adaff6d2aa1d970c1e8 (patch) | |
tree | 00140d6f633d63232a3408d85d7e5a42b497b457 /lib/puppet | |
parent | 48b658fc1c948103eaf04cd10671dd1a6fd61b8c (diff) | |
parent | c7c4d41a8286ab05af65afc1207c8cea4c11ffff (diff) | |
download | puppet-stdlib-76db98120acab12d5aab3adaff6d2aa1d970c1e8.tar.gz puppet-stdlib-76db98120acab12d5aab3adaff6d2aa1d970c1e8.tar.bz2 |
Merge pull request #533 from HelenCampbell/MODULES-2614-Improved
Modules 2614 improved numeric value handling on empty function
Diffstat (limited to 'lib/puppet')
-rw-r--r-- | lib/puppet/parser/functions/empty.rb | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/puppet/parser/functions/empty.rb b/lib/puppet/parser/functions/empty.rb index cca620f..b5a3cde 100644 --- a/lib/puppet/parser/functions/empty.rb +++ b/lib/puppet/parser/functions/empty.rb @@ -13,14 +13,18 @@ Returns true if the variable is empty. value = arguments[0] - unless value.is_a?(Array) || value.is_a?(Hash) || value.is_a?(String) + unless value.is_a?(Array) || value.is_a?(Hash) || value.is_a?(String) || value.is_a?(Numeric) raise(Puppet::ParseError, 'empty(): Requires either ' + - 'array, hash or string to work with') + 'array, hash, string or integer to work with') end - result = value.empty? + if value.is_a?(Numeric) + return false + else + result = value.empty? - return result + return result + end end end |