Module: WebAgent::CookieUtils
- Included in:
- Cookie, CookieManager
- Defined in:
- lib/rss-client/http-access2/cookie.rb
Instance Method Summary collapse
- #domain_match(host, domain) ⇒ Object
- #head_match?(str1, str2) ⇒ Boolean
- #tail_match?(str1, str2) ⇒ Boolean
- #total_dot_num(string) ⇒ Object
Instance Method Details
#domain_match(host, domain) ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/rss-client/http-access2/cookie.rb', line 32 def domain_match(host, domain) case domain when /\d+\.\d+\.\d+\.\d+/ return (host == domain) when '.' return true when /^\./ # allows; host == rubyforge.org, domain == .rubyforge.org return tail_match?(domain, host) || (domain == '.' + host) else return (host == domain) end end |
#head_match?(str1, str2) ⇒ Boolean
20 21 22 |
# File 'lib/rss-client/http-access2/cookie.rb', line 20 def head_match?(str1, str2) str1 == str2[0, str1.length] end |
#tail_match?(str1, str2) ⇒ Boolean
24 25 26 27 28 29 30 |
# File 'lib/rss-client/http-access2/cookie.rb', line 24 def tail_match?(str1, str2) if str1.length > 0 str1 == str2[-str1.length..-1].to_s else true end end |
#total_dot_num(string) ⇒ Object
46 47 48 |
# File 'lib/rss-client/http-access2/cookie.rb', line 46 def total_dot_num(string) string.scan(/\./).length() end |