Skip to content

Commit 72ee9b5

Browse files
committed
Merge pull request #367 from mhaskel/future_parser_fix
Need to convert strings and fixnums to arrays
2 parents fb42396 + c5467cc commit 72ee9b5

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lib/puppet/parser/functions/member.rb

+6-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
module Puppet::Parser::Functions
99
newfunction(:member, :type => :rvalue, :doc => <<-EOS
1010
This function determines if a variable is a member of an array.
11-
The variable can either be a string or an array.
11+
The variable can be a string, fixnum, or array.
1212
1313
*Examples:*
1414
@@ -39,7 +39,11 @@ module Puppet::Parser::Functions
3939
raise(Puppet::ParseError, 'member(): Requires array to work with')
4040
end
4141

42-
if arguments[1].is_a? String
42+
unless arguments[1].is_a? String or arguments[1].is_a? Fixnum or arguments[1].is_a? Array
43+
raise(Puppet::ParseError, 'member(): Item to search for must be a string, fixnum, or array')
44+
end
45+
46+
if arguments[1].is_a? String or arguments[1].is_a? Fixnum
4347
item = Array(arguments[1])
4448
else
4549
item = arguments[1]

0 commit comments

Comments
 (0)