lib/postrank-uri.rb in postrank-uri-1.0.15 vs lib/postrank-uri.rb in postrank-uri-1.0.16
- old
+ new
@@ -162,17 +162,17 @@
def c18n(uri, opts = {})
u = parse(uri, opts)
u = embedded(u)
- if q = u.query_values(:notation => :flat_array)
+ if q = u.query_values(Array)
q.delete_if { |k,v| C18N[:global].include?(k) }
q.delete_if { |k,v| C18N[:hosts].find {|r,p| u.host =~ r && p.include?(k) } }
end
u.query_values = q
- if u.host == 'twitter.com' && u.fragment && u.fragment.match(/^!(.*)/)
+ if u.host =~ /^(mobile\.)?twitter\.com$/ && u.fragment && u.fragment.match(/^!(.*)/)
u.fragment = nil
u.path = $1
end
if u.host =~ /tumblr\.com$/ && u.path =~ /\/post\/\d+\//
@@ -220,8 +220,13 @@
uri.scheme = 'http' if uri.host && !uri.scheme
uri.normalize!
end
+ def valid?(uri)
+ Domainatrix.parse(uri)
+ true
+ rescue
+ false
+ end
end
end
-