Module: WebAgent::CookieUtils

Included in:
Cookie, CookieManager
Defined in:
lib/rubyforge.rb,
lib/http-access2/cookie.rb

Overview

:nodoc: all

Instance Method Summary collapse

Instance Method Details

#domain_match(host, domain) ⇒ Object



14
15
16
17
18
19
20
21
# File 'lib/rubyforge.rb', line 14

def domain_match(host, domain)
  case domain
  when /^\./
    return tail_match?(host, domain) # was (domain, host)
  else
    return old_domain_match(host, domain)
  end
end

#head_match?(str1, str2) ⇒ Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/http-access2/cookie.rb', line 20

def head_match?(str1, str2)
  str1 == str2[0, str1.length]
end

#old_domain_matchObject



13
# File 'lib/rubyforge.rb', line 13

alias :old_domain_match :domain_match

#tail_match?(str1, str2) ⇒ Boolean

Returns:

  • (Boolean)


24
25
26
27
28
29
30
# File 'lib/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



45
46
47
# File 'lib/http-access2/cookie.rb', line 45

def total_dot_num(string)
  string.scan(/\./).length()
end