Parent

Class Index [+]

Quicksearch

Merb::Test::Cookie

Attributes

name[R]

:api: private

value[R]

:api: private

Public Class Methods

new(raw, default_host) click to toggle source

:api: private

    # File lib/merb-core/test/helpers/cookie_jar.rb, line 11
11:       def initialize(raw, default_host)
12:         # separate the name / value pair from the cookie options
13:         @name_value_raw, options = raw.split(/[;,] */, 2)
14:         
15:         @name, @value = Merb::Parse.query(@name_value_raw, ';').to_a.first
16:         @options = Merb::Parse.query(options, ';')
17:         
18:         @options.delete_if { |k, v| !v || v.empty? }
19:         
20:         @options["domain"] ||= default_host
21:       end

Public Instance Methods

<=>(other) click to toggle source

:api: private

    # File lib/merb-core/test/helpers/cookie_jar.rb, line 68
68:       def <=>(other)
69:         # Orders the cookies from least specific to most
70:         [name, path, domain.reverse] <=> [other.name, other.path, other.domain.reverse]
71:       end
domain() click to toggle source

:api: private

    # File lib/merb-core/test/helpers/cookie_jar.rb, line 34
34:       def domain
35:         @options["domain"]
36:       end
empty?() click to toggle source

:api: private

    # File lib/merb-core/test/helpers/cookie_jar.rb, line 29
29:       def empty?
30:         @value.nil? || @value.empty?
31:       end
expired?() click to toggle source

:api: private

    # File lib/merb-core/test/helpers/cookie_jar.rb, line 49
49:       def expired?
50:         expires && expires < Time.now
51:       end
expires() click to toggle source

:api: private

    # File lib/merb-core/test/helpers/cookie_jar.rb, line 44
44:       def expires
45:         Time.parse(@options["expires"]) if @options["expires"]
46:       end
matches?(uri) click to toggle source

:api: private

    # File lib/merb-core/test/helpers/cookie_jar.rb, line 63
63:       def matches?(uri)
64:         ! expired? && valid?(uri)
65:       end
path() click to toggle source

:api: private

    # File lib/merb-core/test/helpers/cookie_jar.rb, line 39
39:       def path
40:         @options["path"] || "/"
41:       end
raw() click to toggle source

:api: private

    # File lib/merb-core/test/helpers/cookie_jar.rb, line 24
24:       def raw
25:         @name_value_raw
26:       end
valid?(uri) click to toggle source

:api: private

    # File lib/merb-core/test/helpers/cookie_jar.rb, line 54
54:       def valid?(uri)
55:         domain_ = domain.index('.') == 0 ? domain[1..1] : domain
56:         uri_path = uri.path.blank? ? "/" : uri.path
57: 
58:         uri.host =~ Regexp.new("#{Regexp.escape(domain_)}$") &&
59:         uri_path =~ Regexp.new("^#{Regexp.escape(path)}")
60:       end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.