Class: TextHelper

Inherits:
Object
  • Object
show all
Defined in:
lib/helpers/text_helper.rb

Class Method Summary collapse

Class Method Details

.clean_text(text) ⇒ Object



2
3
4
5
6
7
8
# File 'lib/helpers/text_helper.rb', line 2

def self.clean_text(text)
  clean_text = Sanitize.clean(text)
  clean_text.gsub!("\n", " ")
  clean_text.gsub!("\t", " ")
  clean_text.gsub!(/((http|https|ftp|ftps):\/\/)?([a-zA-Z0-9\-]*\.)+[a-zA-Z0-9]{2,4}(\/[a-zA-Z0-9=.?&-]*)?/i, "")
  return clean_text.strip.gsub("&", "&")
end