module Gemmy::Patches::StringPatch::InstanceMethods::AsciiOnly
Public Instance Methods
ascii_only(alt='')
click to toggle source
facets remove non ascii characters
# File lib/gemmy/patches/string_patch.rb, line 259 def ascii_only(alt='') encoding_options = { :invalid => :replace, # Replace invalid byte sequences :undef => :replace, # Replace anything not defined in ASCII :replace => alt, # Use a blank for those replacements :UNIVERSAL_NEWLINE_DECORATOR => true # Always break lines with \n } self.encode(Encoding.find('ASCII'), encoding_options) end