# File lib/openid/trustroot.rb, line 62 def sane? return true if @host == 'localhost' host_parts = @host.split('.') return false unless TOP_LEVEL_DOMAINS.member?(host_parts[-1]) # wacky heurestic for extracting a sane tld host = [] if host_parts[-1].length == 2 and host_parts.length > 1 if host_parts[-2].length <= 3 host = host_parts[0...-2] end elsif host_parts[-1].length == 3 host = host_parts[0...-1] end return (host.length > 0) end