Class: String
Instance Method Summary collapse
Instance Method Details
#to_md5 ⇒ Object
54 55 56 |
# File 'lib/sh_util.rb', line 54 def to_md5 return (Digest::MD5.new << self).to_s end |
#to_u ⇒ Object
58 59 60 61 62 63 64 65 |
# File 'lib/sh_util.rb', line 58 def to_u if is_binary_data? return isutf8 ? self : nil else utf8 = isutf8 return utf8 ? utf8.to_s : unpack('C*').pack('U*') end end |
#unescape_html ⇒ Object
67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/sh_util.rb', line 67 def unescape_html entities = { """ => "\"", "'" => "'", "&" => "&", "<" => "<", ">" => ">", " " => " " } return CGI.unescapeHTML(self.gsub(/&\w*;/) {|e| entities[e] || e}) end |