Module: DataMapper::YS::Scraper::Utils

Defined in:
lib/dm-ys/scraper.rb

Overview

Utils

Class Method Summary collapse

Class Method Details

.constantize(label) ⇒ Object



34
35
36
37
38
39
40
41
42
43
# File 'lib/dm-ys/scraper.rb', line 34

def constantize(label)
  require 'cgi'
  label = CGI.unescapeHTML(label.to_s)
  label.gsub!(/&[a-z]+;/, '')
  label.gsub!(/\r?\n/, '')
  label.gsub!(/\s+/,'')
  label.delete!('!"#$%&()=~|`{}^-[]/<>:;,.\\-')
  label.delete!("'")
  return label
end