mirror of
https://github.com/meineerde/rackstash.git
synced 2025-10-17 14:01:01 +00:00
Preemptively freeze more Strings on normalize to ensure that we don't create unnecessary copies
This commit is contained in:
parent
ab7331a7a9
commit
65e272347d
@ -143,11 +143,11 @@ module Rackstash
|
||||
when ::Date
|
||||
return value.iso8601.encode!(Encoding::UTF_8).freeze
|
||||
when ::Regexp, ::Range, ::URI::Generic, ::Pathname
|
||||
return utf8_encode(value)
|
||||
return utf8_encode(value.to_s.freeze)
|
||||
when Exception
|
||||
exception = "#{value.message} (#{value.class})"
|
||||
exception = [exception, *value.backtrace].join("\n") if value.backtrace
|
||||
return utf8_encode(exception)
|
||||
return utf8_encode(exception.freeze)
|
||||
when ::Proc
|
||||
return normalize(value, scope: scope, wrap: wrap)
|
||||
when ::BigDecimal
|
||||
|
||||
@ -76,7 +76,7 @@ module Rackstash
|
||||
value.flatten!
|
||||
value
|
||||
else
|
||||
utf8_encode(value).strip.freeze
|
||||
utf8_encode(value.to_s.strip.freeze)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user