summaryrefslogtreecommitdiffhomepage
path: root/lib
diff options
context:
space:
mode:
authorWinfield Peterson <[email protected]>2017-11-29 14:41:18 -0500
committerWinfield Peterson <[email protected]>2017-11-29 14:41:18 -0500
commite50f636dc0d2cd96772a6b55934bf9a7773f21fa (patch)
treecdb7b105e7261572258d7f666828e121f23618c8 /lib
parentc8ac844572b25fda358cc01d2104720c4c42f450 (diff)
downloadcaxlsx-e50f636dc0d2cd96772a6b55934bf9a7773f21fa.tar.gz
caxlsx-e50f636dc0d2cd96772a6b55934bf9a7773f21fa.zip
Axlsx.sanitize uses delete() vs. delete!() for frozen strings
Whenever a frozen string is passed as an input to any sanitized value, we are modifying it in place which raised a RuntimeError if that string is frozen (as you might expect constants like header or workbook names to be). Use the safer delete() method which creates a new, modified copy of the string.
Diffstat (limited to 'lib')
-rw-r--r--lib/axlsx.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/axlsx.rb b/lib/axlsx.rb
index c5d26c2b..20b5cab0 100644
--- a/lib/axlsx.rb
+++ b/lib/axlsx.rb
@@ -136,10 +136,10 @@ module Axlsx
# @param [String] str The string to process
# @return [String]
def self.sanitize(str)
- str.delete!(CONTROL_CHARS)
+ str.delete(CONTROL_CHARS)
str
end
-
+
# If value is boolean return 1 or 0
# else return the value
# @param [Object] value The value to process