Skip to content

Commit

Permalink
Fix bug: don't do the sprintf in-place, but actually return new objects
Browse files Browse the repository at this point in the history
  • Loading branch information
idrisskettereruserlane committed Dec 13, 2019
1 parent 6ff821d commit 3406ed8
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/logstash/outputs/slack.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,18 @@ def register
def recursive_sprintf(event, node)
case node
when String
node = event.sprintf(node)
ret = event.sprintf(node)
when Array
node.map! do |obj|
ret = node.map do |obj|
recursive_sprintf( event, obj )
end
when Hash
ret = Hash.new
node.each_pair do |key, value|
node[key] = recursive_sprintf( event, value )
ret[key] = recursive_sprintf( event, value )
end
end
node
ret
end

public
Expand Down

0 comments on commit 3406ed8

Please sign in to comment.