Files

WebAgent::CookieUtils

Public Instance Methods

domain_match(host, domain) click to toggle source
    # File lib/httpclient/cookie.rb, line 34
34:     def domain_match(host, domain)
35:       domainname = domain.sub(/\.\z/, '').downcase
36:       hostname = host.sub(/\.\z/, '').downcase
37:       case domain
38:       when /\d+\.\d+\.\d+\.\d+/
39:         return (hostname == domainname)
40:       when '.' 
41:         return true
42:       when /^\./
43:         # allows; host == rubyforge.org, domain == .rubyforge.org
44:         return tail_match?(domainname, '.' + hostname)
45:       else
46:         return (hostname == domainname)
47:       end
48:     end
head_match?(str1, str2) click to toggle source
    # File lib/httpclient/cookie.rb, line 22
22:     def head_match?(str1, str2)
23:       str1 == str2[0, str1.length]
24:     end
tail_match?(str1, str2) click to toggle source
    # File lib/httpclient/cookie.rb, line 26
26:     def tail_match?(str1, str2)
27:       if str1.length > 0
28:         str1 == str2[-str1.length..1].to_s
29:       else
30:         true
31:       end
32:     end
total_dot_num(string) click to toggle source
    # File lib/httpclient/cookie.rb, line 50
50:     def total_dot_num(string)
51:       string.scan(/\./).length()
52:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.