summaryrefslogtreecommitdiff
path: root/lib/puppet/parser
diff options
context:
space:
mode:
authorMorgan Haskel <morgan@puppetlabs.com>2014-11-14 14:33:59 -0800
committerMorgan Haskel <morgan@puppetlabs.com>2014-11-17 12:27:05 -0800
commitc5467cc507c004d75037d07c70633d1e743825af (patch)
treea65a35e21de70c8ddcb86d7cbde7cf904b669102 /lib/puppet/parser
parentfb42396c75d90ce3a9473e2a7ed22682266ea03f (diff)
downloadpuppet-stdlib-c5467cc507c004d75037d07c70633d1e743825af.tar.gz
puppet-stdlib-c5467cc507c004d75037d07c70633d1e743825af.tar.bz2
Need to convert strings and fixnums to arrays
Diffstat (limited to 'lib/puppet/parser')
-rw-r--r--lib/puppet/parser/functions/member.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/puppet/parser/functions/member.rb b/lib/puppet/parser/functions/member.rb
index bb19a86..88609ce 100644
--- a/lib/puppet/parser/functions/member.rb
+++ b/lib/puppet/parser/functions/member.rb
@@ -8,7 +8,7 @@
module Puppet::Parser::Functions
newfunction(:member, :type => :rvalue, :doc => <<-EOS
This function determines if a variable is a member of an array.
-The variable can either be a string or an array.
+The variable can be a string, fixnum, or array.
*Examples:*
@@ -39,7 +39,11 @@ would return: false
raise(Puppet::ParseError, 'member(): Requires array to work with')
end
- if arguments[1].is_a? String
+ unless arguments[1].is_a? String or arguments[1].is_a? Fixnum or arguments[1].is_a? Array
+ raise(Puppet::ParseError, 'member(): Item to search for must be a string, fixnum, or array')
+ end
+
+ if arguments[1].is_a? String or arguments[1].is_a? Fixnum
item = Array(arguments[1])
else
item = arguments[1]