# File lib/core/facets/string/ascii_only.rb, line 17 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