lib/postrank-uri.rb in postrank-uri-1.0.4 vs lib/postrank-uri.rb in postrank-uri-1.0.5
- old
+ new
@@ -1,9 +1,10 @@
# -*- encoding: utf-8 -*-
require 'addressable/uri'
require 'domainatrix'
+require 'digest/md5'
require 'nokogiri'
require 'yaml'
module PostRank
module URI
@@ -113,9 +114,13 @@
end
def clean(uri, string = true)
uri = normalize(c18n(unescape(uri)))
string ? uri.to_s : uri
+ end
+
+ def hash(uri)
+ Digest::MD5.hexdigest(clean(uri))
end
def normalize(uri)
u = parse(uri)
u.path = u.path.squeeze('/')
\ No newline at end of file