# File lib/httpclient/cookie.rb, line 34 def domain_match(host, domain) domainname = domain.sub(%r\.\z/, '').downcase hostname = host.sub(%r\.\z/, '').downcase case domain when %r\d+\.\d+\.\d+\.\d+/ return (hostname == domainname) when '.' return true when %r^\./ # allows; host == rubyforge.org, domain == .rubyforge.org return tail_match?(domainname, '.' + hostname) else return (hostname == domainname) end end
# File lib/httpclient/cookie.rb, line 22 def head_match?(str1, str2) str1 == str2[0, str1.length] end
# File lib/httpclient/cookie.rb, line 26 def tail_match?(str1, str2) if str1.length > 0 str1 == str2[-str1.length..-1].to_s else true end end
# File lib/httpclient/cookie.rb, line 50 def total_dot_num(string) string.scan(%r\./).length() end