lib/axlsx.rb in axlsx-2.1.0.pre vs lib/axlsx.rb in axlsx-3.0.0.pre
- old
+ new
@@ -1,18 +1,19 @@
# encoding: UTF-8
require 'htmlentities'
require 'axlsx/version.rb'
+require 'mimemagic'
require 'axlsx/util/simple_typed_list.rb'
require 'axlsx/util/constants.rb'
require 'axlsx/util/validators.rb'
require 'axlsx/util/accessors.rb'
require 'axlsx/util/serialized_attributes'
require 'axlsx/util/options_parser'
# to be included with parsable intitites.
#require 'axlsx/util/parser.rb'
-require 'axlsx/util/string'
+require 'axlsx/util/mime_type_utils'
require 'axlsx/stylesheet/styles.rb'
require 'axlsx/doc_props/app.rb'
require 'axlsx/doc_props/core.rb'
@@ -132,13 +133,17 @@
# returns the provided string with all invalid control charaters
# removed.
# @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
# @return [Object]
def self.booleanize(value)