diff options
| author | Randy Morgan (@morgan_randy) <[email protected]> | 2018-02-07 11:19:54 +0900 |
|---|---|---|
| committer | GitHub <[email protected]> | 2018-02-07 11:19:54 +0900 |
| commit | 545d77371cf81c368ccfd761e5409cbc7e141711 (patch) | |
| tree | ebf7364735aab38006fe30654e9b5b4f7a954db2 /lib | |
| parent | b1d6c0a3ef1bd50228947f48f1034b9d42a9a405 (diff) | |
| parent | b34286f6975679e9e5eb390241eb05f95759461b (diff) | |
| download | caxlsx-545d77371cf81c368ccfd761e5409cbc7e141711.tar.gz caxlsx-545d77371cf81c368ccfd761e5409cbc7e141711.zip | |
Merge pull request #565 from ezcater/safe_frozen_sanitize
Axlsx.sanitize() uses delete() vs. delete!() for frozen strings
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/axlsx.rb | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/axlsx.rb b/lib/axlsx.rb index c5d26c2b..586562f6 100644 --- a/lib/axlsx.rb +++ b/lib/axlsx.rb @@ -136,10 +136,14 @@ module Axlsx # @param [String] str The string to process # @return [String] def self.sanitize(str) - str.delete!(CONTROL_CHARS) - str + if str.frozen? + str.delete(CONTROL_CHARS) + else + str.delete!(CONTROL_CHARS) + str + end end - + # If value is boolean return 1 or 0 # else return the value # @param [Object] value The value to process |
