:api: private
# File lib/merb-core/test/helpers/cookie_jar.rb, line 11 def initialize(raw, default_host) # separate the name / value pair from the cookie options @name_value_raw, options = raw.split(/[;,] */, 2) @name, @value = Merb::Parse.query(@name_value_raw, ';').to_a.first @options = Merb::Parse.query(options, ';') @options.delete_if { |k, v| !v || v.empty? } @options["domain"] ||= default_host end
:api: private
# File lib/merb-core/test/helpers/cookie_jar.rb, line 68 def <=>(other) # Orders the cookies from least specific to most [name, path, domain.reverse] <=> [other.name, other.path, other.domain.reverse] end
:api: private
# File lib/merb-core/test/helpers/cookie_jar.rb, line 34 def domain @options["domain"] end
:api: private
# File lib/merb-core/test/helpers/cookie_jar.rb, line 29 def empty? @value.nil? || @value.empty? end
:api: private
# File lib/merb-core/test/helpers/cookie_jar.rb, line 49 def expired? expires && expires < Time.now end
:api: private
# File lib/merb-core/test/helpers/cookie_jar.rb, line 44 def expires Time.parse(@options["expires"]) if @options["expires"] end
:api: private
# File lib/merb-core/test/helpers/cookie_jar.rb, line 63 def matches?(uri) ! expired? && valid?(uri) end
:api: private
# File lib/merb-core/test/helpers/cookie_jar.rb, line 39 def path @options["path"] || "/" end
:api: private
# File lib/merb-core/test/helpers/cookie_jar.rb, line 24 def raw @name_value_raw end
:api: private
# File lib/merb-core/test/helpers/cookie_jar.rb, line 54 def valid?(uri) domain_ = domain.index('.') == 0 ? domain[1..-1] : domain uri_path = uri.path.blank? ? "/" : uri.path uri.host =~ Regexp.new("#{Regexp.escape(domain_)}$") && uri_path =~ Regexp.new("^#{Regexp.escape(path)}") end
Generated with the Darkfish Rdoc Generator 2.