Skip to content

Commit

Permalink
Need to convert strings and fixnums to arrays
Browse files Browse the repository at this point in the history
  • Loading branch information
Morgan Haskel committed Nov 17, 2014
1 parent fb42396 commit c5467cc
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/puppet/parser/functions/member.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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:*
Expand Down Expand Up @@ -39,7 +39,11 @@ module Puppet::Parser::Functions
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]
Expand Down

0 comments on commit c5467cc

Please sign in to comment.