Skip to content

Commit

Permalink
Use a more expressive method of rewriting values
Browse files Browse the repository at this point in the history
This achieves almost the same, except that this version doesn't change
the original value. If that's really desired, `transform_values!` can be
used. It makes it clearer what's going on.
  • Loading branch information
ekohl committed Apr 2, 2024
1 parent c4785ff commit 5c5fb15
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions lib/puppet/type/rabbitmq_parameter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,6 @@ def validate_value(value)
def munge_value(value)
return value if value(:autoconvert) == :false

value.each do |k, v|
value[k] = v.to_i if v =~ %r{\A[-+]?[0-9]+\z}
end
value
value.transform_values { |v| v =~ %r{\A[-+]?[0-9]+\z} ? v.to_i : v }
end
end

0 comments on commit 5c5fb15

Please sign in to comment.