Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/puppet/parser/functions/upcase.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ module Puppet::Parser::Functions
result = value.collect { |i| i.is_a?(String) ? i.upcase : i }
elsif value.is_a?(Hash)
result = {}
result << value.each_pair do |k, v|
return {k.upcase => v.collect! { |p| p.upcase }}
value.each_pair do |k, v|
result.merge!({k.upcase => v.collect! { |p| p.upcase }})
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not instead do:

result[k.upcase] = v.collect { |p| p.upcase}

This results in significantly object creations.

Additionally, this will fail if v is a nested array or a hash.

end
else
result = value.upcase
Expand Down