From e50f636dc0d2cd96772a6b55934bf9a7773f21fa Mon Sep 17 00:00:00 2001 From: Winfield Peterson Date: Wed, 29 Nov 2017 14:41:18 -0500 Subject: 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. --- lib/axlsx.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib') 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 -- cgit v1.2.3