Method: String#unescape_html

Defined in:
lib/sh_util.rb

#unescape_htmlObject



67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/sh_util.rb', line 67

def unescape_html
  entities = {
    """ => "\"",
    "'" => "'",
    "&" => "&",
    "&lt;" => "<",
    "&gt;" => ">",
    "&nbsp;" => " "
  }

  return CGI.unescapeHTML(self.gsub(/&\w*;/) {|e| entities[e] || e})
end