Class: Manticore::Cookie
- Inherits:
-
Object
- Object
- Manticore::Cookie
- Defined in:
- lib/manticore/cookie.rb
Instance Attribute Summary collapse
-
#comment ⇒ String
readonly
Returns the comment describing the purpose of this cookie, or nil if no such comment has been defined.
-
#comment_url ⇒ String
readonly
If a user agent (web browser) presents this cookie to a user, the cookie’s purpose will be described by the information at this URL.
-
#domain ⇒ String
readonly
Returns domain attribute of the cookie.
-
#expires ⇒ Object
readonly
Returns the value of attribute expires.
-
#expiry_date ⇒ Time
readonly
Returns the expiration Date of the cookie, or nil if none exists.
-
#name ⇒ String
readonly
Returns the name of the cookie.
-
#path ⇒ String
readonly
Returns the path attribute of the cookie.
-
#ports ⇒ Array<Integer>
readonly
Returns the ports attribute of the cookie.
-
#spec_version ⇒ Integer
readonly
Returns the version of the cookie specification to which this cookie conforms.
-
#value ⇒ Array<Integer>
readonly
Returns the cookie value.
Class Method Summary collapse
-
.from_java(cookie) ⇒ Object
Create a Manticore::Cookie wrapper from a org.apache.http.cookie.Cookie.
- .from_set_cookie(value) ⇒ Object
Instance Method Summary collapse
-
#expired?(date = Time.now) ⇒ Boolean
Whether this cookie is expired at the comparison date.
-
#initialize(args) ⇒ Cookie
constructor
A new instance of Cookie.
-
#persistent? ⇒ Boolean
Whether this is a persistent (session-only) cookie.
-
#secure? ⇒ Boolean
Whether this is a HTTPS-only cookie.
-
#session? ⇒ Boolean
Whether this is a session-only cookie.
Constructor Details
#initialize(args) ⇒ Cookie
Returns a new instance of Cookie.
65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/manticore/cookie.rb', line 65 def initialize(args) @comment = args.fetch(:comment, nil) @comment_url = args.fetch(:comment_url, nil) @domain = args.fetch(:domain, nil) @expires = args.fetch(:expires, nil) @name = args.fetch(:name, nil) @path = args.fetch(:path, nil) @ports = args.fetch(:ports, nil) @value = args.fetch(:value, nil) @secure = args.fetch(:secure, nil) @persistent = args.fetch(:persistent, nil) @spec_version = args.fetch(:spec_version, nil) end |
Instance Attribute Details
#comment ⇒ String (readonly)
Returns the comment describing the purpose of this cookie, or nil if no such comment has been defined.
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/manticore/cookie.rb', line 20 class Cookie # @private # Create a Manticore::Cookie wrapper from a org.apache.http.cookie.Cookie def self.from_java() if .get_expiry_date expiry = Time.at(.get_expiry_date / 1000) end new( comment: .get_comment, comment_url: .getCommentURL, domain: .get_domain, expires: expiry, name: .get_name, path: .get_path, ports: .get_ports.to_a, value: .get_value, secure: .is_secure, persistent: .is_persistent, spec_version: .get_version ) end def self.(value) opts = {name: nil, value: nil} value.split(";").each do |part| k, v = part.split("=", 2).map(&:strip) if opts[:name].nil? opts[:name] = k opts[:value] = v end case k.downcase when "domain", "path" opts[k.to_sym] = v when "secure" opts[:secure] = true end end Manticore::Cookie.new opts end attr_reader :comment, :comment_url, :domain, :expires, :name, :path, :ports, :value, :spec_version def initialize(args) @comment = args.fetch(:comment, nil) @comment_url = args.fetch(:comment_url, nil) @domain = args.fetch(:domain, nil) @expires = args.fetch(:expires, nil) @name = args.fetch(:name, nil) @path = args.fetch(:path, nil) @ports = args.fetch(:ports, nil) @value = args.fetch(:value, nil) @secure = args.fetch(:secure, nil) @persistent = args.fetch(:persistent, nil) @spec_version = args.fetch(:spec_version, nil) end # @param date [Time] Time to compare against # # @return [Boolean] Whether this cookie is expired at the comparison date def expired?(date = Time.now) @expiry_date > date end # Whether this is a HTTPS-only cookie # # @return [Boolean] def secure? @secure end # Whether this is a persistent (session-only) cookie # # @return [Boolean] def persistent? @persistent end # Whether this is a session-only cookie # # @return [Boolean] def session? !@persistent end end |
#comment_url ⇒ String (readonly)
Returns If a user agent (web browser) presents this cookie to a user, the cookie’s purpose will be described by the information at this URL.
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/manticore/cookie.rb', line 20 class Cookie # @private # Create a Manticore::Cookie wrapper from a org.apache.http.cookie.Cookie def self.from_java() if .get_expiry_date expiry = Time.at(.get_expiry_date / 1000) end new( comment: .get_comment, comment_url: .getCommentURL, domain: .get_domain, expires: expiry, name: .get_name, path: .get_path, ports: .get_ports.to_a, value: .get_value, secure: .is_secure, persistent: .is_persistent, spec_version: .get_version ) end def self.(value) opts = {name: nil, value: nil} value.split(";").each do |part| k, v = part.split("=", 2).map(&:strip) if opts[:name].nil? opts[:name] = k opts[:value] = v end case k.downcase when "domain", "path" opts[k.to_sym] = v when "secure" opts[:secure] = true end end Manticore::Cookie.new opts end attr_reader :comment, :comment_url, :domain, :expires, :name, :path, :ports, :value, :spec_version def initialize(args) @comment = args.fetch(:comment, nil) @comment_url = args.fetch(:comment_url, nil) @domain = args.fetch(:domain, nil) @expires = args.fetch(:expires, nil) @name = args.fetch(:name, nil) @path = args.fetch(:path, nil) @ports = args.fetch(:ports, nil) @value = args.fetch(:value, nil) @secure = args.fetch(:secure, nil) @persistent = args.fetch(:persistent, nil) @spec_version = args.fetch(:spec_version, nil) end # @param date [Time] Time to compare against # # @return [Boolean] Whether this cookie is expired at the comparison date def expired?(date = Time.now) @expiry_date > date end # Whether this is a HTTPS-only cookie # # @return [Boolean] def secure? @secure end # Whether this is a persistent (session-only) cookie # # @return [Boolean] def persistent? @persistent end # Whether this is a session-only cookie # # @return [Boolean] def session? !@persistent end end |
#domain ⇒ String (readonly)
Returns domain attribute of the cookie.
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/manticore/cookie.rb', line 20 class Cookie # @private # Create a Manticore::Cookie wrapper from a org.apache.http.cookie.Cookie def self.from_java() if .get_expiry_date expiry = Time.at(.get_expiry_date / 1000) end new( comment: .get_comment, comment_url: .getCommentURL, domain: .get_domain, expires: expiry, name: .get_name, path: .get_path, ports: .get_ports.to_a, value: .get_value, secure: .is_secure, persistent: .is_persistent, spec_version: .get_version ) end def self.(value) opts = {name: nil, value: nil} value.split(";").each do |part| k, v = part.split("=", 2).map(&:strip) if opts[:name].nil? opts[:name] = k opts[:value] = v end case k.downcase when "domain", "path" opts[k.to_sym] = v when "secure" opts[:secure] = true end end Manticore::Cookie.new opts end attr_reader :comment, :comment_url, :domain, :expires, :name, :path, :ports, :value, :spec_version def initialize(args) @comment = args.fetch(:comment, nil) @comment_url = args.fetch(:comment_url, nil) @domain = args.fetch(:domain, nil) @expires = args.fetch(:expires, nil) @name = args.fetch(:name, nil) @path = args.fetch(:path, nil) @ports = args.fetch(:ports, nil) @value = args.fetch(:value, nil) @secure = args.fetch(:secure, nil) @persistent = args.fetch(:persistent, nil) @spec_version = args.fetch(:spec_version, nil) end # @param date [Time] Time to compare against # # @return [Boolean] Whether this cookie is expired at the comparison date def expired?(date = Time.now) @expiry_date > date end # Whether this is a HTTPS-only cookie # # @return [Boolean] def secure? @secure end # Whether this is a persistent (session-only) cookie # # @return [Boolean] def persistent? @persistent end # Whether this is a session-only cookie # # @return [Boolean] def session? !@persistent end end |
#expires ⇒ Object (readonly)
Returns the value of attribute expires.
63 64 65 |
# File 'lib/manticore/cookie.rb', line 63 def expires @expires end |
#expiry_date ⇒ Time (readonly)
Returns the expiration Date of the cookie, or nil if none exists.
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/manticore/cookie.rb', line 20 class Cookie # @private # Create a Manticore::Cookie wrapper from a org.apache.http.cookie.Cookie def self.from_java() if .get_expiry_date expiry = Time.at(.get_expiry_date / 1000) end new( comment: .get_comment, comment_url: .getCommentURL, domain: .get_domain, expires: expiry, name: .get_name, path: .get_path, ports: .get_ports.to_a, value: .get_value, secure: .is_secure, persistent: .is_persistent, spec_version: .get_version ) end def self.(value) opts = {name: nil, value: nil} value.split(";").each do |part| k, v = part.split("=", 2).map(&:strip) if opts[:name].nil? opts[:name] = k opts[:value] = v end case k.downcase when "domain", "path" opts[k.to_sym] = v when "secure" opts[:secure] = true end end Manticore::Cookie.new opts end attr_reader :comment, :comment_url, :domain, :expires, :name, :path, :ports, :value, :spec_version def initialize(args) @comment = args.fetch(:comment, nil) @comment_url = args.fetch(:comment_url, nil) @domain = args.fetch(:domain, nil) @expires = args.fetch(:expires, nil) @name = args.fetch(:name, nil) @path = args.fetch(:path, nil) @ports = args.fetch(:ports, nil) @value = args.fetch(:value, nil) @secure = args.fetch(:secure, nil) @persistent = args.fetch(:persistent, nil) @spec_version = args.fetch(:spec_version, nil) end # @param date [Time] Time to compare against # # @return [Boolean] Whether this cookie is expired at the comparison date def expired?(date = Time.now) @expiry_date > date end # Whether this is a HTTPS-only cookie # # @return [Boolean] def secure? @secure end # Whether this is a persistent (session-only) cookie # # @return [Boolean] def persistent? @persistent end # Whether this is a session-only cookie # # @return [Boolean] def session? !@persistent end end |
#name ⇒ String (readonly)
Returns the name of the cookie.
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/manticore/cookie.rb', line 20 class Cookie # @private # Create a Manticore::Cookie wrapper from a org.apache.http.cookie.Cookie def self.from_java() if .get_expiry_date expiry = Time.at(.get_expiry_date / 1000) end new( comment: .get_comment, comment_url: .getCommentURL, domain: .get_domain, expires: expiry, name: .get_name, path: .get_path, ports: .get_ports.to_a, value: .get_value, secure: .is_secure, persistent: .is_persistent, spec_version: .get_version ) end def self.(value) opts = {name: nil, value: nil} value.split(";").each do |part| k, v = part.split("=", 2).map(&:strip) if opts[:name].nil? opts[:name] = k opts[:value] = v end case k.downcase when "domain", "path" opts[k.to_sym] = v when "secure" opts[:secure] = true end end Manticore::Cookie.new opts end attr_reader :comment, :comment_url, :domain, :expires, :name, :path, :ports, :value, :spec_version def initialize(args) @comment = args.fetch(:comment, nil) @comment_url = args.fetch(:comment_url, nil) @domain = args.fetch(:domain, nil) @expires = args.fetch(:expires, nil) @name = args.fetch(:name, nil) @path = args.fetch(:path, nil) @ports = args.fetch(:ports, nil) @value = args.fetch(:value, nil) @secure = args.fetch(:secure, nil) @persistent = args.fetch(:persistent, nil) @spec_version = args.fetch(:spec_version, nil) end # @param date [Time] Time to compare against # # @return [Boolean] Whether this cookie is expired at the comparison date def expired?(date = Time.now) @expiry_date > date end # Whether this is a HTTPS-only cookie # # @return [Boolean] def secure? @secure end # Whether this is a persistent (session-only) cookie # # @return [Boolean] def persistent? @persistent end # Whether this is a session-only cookie # # @return [Boolean] def session? !@persistent end end |
#path ⇒ String (readonly)
Returns the path attribute of the cookie.
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/manticore/cookie.rb', line 20 class Cookie # @private # Create a Manticore::Cookie wrapper from a org.apache.http.cookie.Cookie def self.from_java() if .get_expiry_date expiry = Time.at(.get_expiry_date / 1000) end new( comment: .get_comment, comment_url: .getCommentURL, domain: .get_domain, expires: expiry, name: .get_name, path: .get_path, ports: .get_ports.to_a, value: .get_value, secure: .is_secure, persistent: .is_persistent, spec_version: .get_version ) end def self.(value) opts = {name: nil, value: nil} value.split(";").each do |part| k, v = part.split("=", 2).map(&:strip) if opts[:name].nil? opts[:name] = k opts[:value] = v end case k.downcase when "domain", "path" opts[k.to_sym] = v when "secure" opts[:secure] = true end end Manticore::Cookie.new opts end attr_reader :comment, :comment_url, :domain, :expires, :name, :path, :ports, :value, :spec_version def initialize(args) @comment = args.fetch(:comment, nil) @comment_url = args.fetch(:comment_url, nil) @domain = args.fetch(:domain, nil) @expires = args.fetch(:expires, nil) @name = args.fetch(:name, nil) @path = args.fetch(:path, nil) @ports = args.fetch(:ports, nil) @value = args.fetch(:value, nil) @secure = args.fetch(:secure, nil) @persistent = args.fetch(:persistent, nil) @spec_version = args.fetch(:spec_version, nil) end # @param date [Time] Time to compare against # # @return [Boolean] Whether this cookie is expired at the comparison date def expired?(date = Time.now) @expiry_date > date end # Whether this is a HTTPS-only cookie # # @return [Boolean] def secure? @secure end # Whether this is a persistent (session-only) cookie # # @return [Boolean] def persistent? @persistent end # Whether this is a session-only cookie # # @return [Boolean] def session? !@persistent end end |
#ports ⇒ Array<Integer> (readonly)
Returns the ports attribute of the cookie.
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/manticore/cookie.rb', line 20 class Cookie # @private # Create a Manticore::Cookie wrapper from a org.apache.http.cookie.Cookie def self.from_java() if .get_expiry_date expiry = Time.at(.get_expiry_date / 1000) end new( comment: .get_comment, comment_url: .getCommentURL, domain: .get_domain, expires: expiry, name: .get_name, path: .get_path, ports: .get_ports.to_a, value: .get_value, secure: .is_secure, persistent: .is_persistent, spec_version: .get_version ) end def self.(value) opts = {name: nil, value: nil} value.split(";").each do |part| k, v = part.split("=", 2).map(&:strip) if opts[:name].nil? opts[:name] = k opts[:value] = v end case k.downcase when "domain", "path" opts[k.to_sym] = v when "secure" opts[:secure] = true end end Manticore::Cookie.new opts end attr_reader :comment, :comment_url, :domain, :expires, :name, :path, :ports, :value, :spec_version def initialize(args) @comment = args.fetch(:comment, nil) @comment_url = args.fetch(:comment_url, nil) @domain = args.fetch(:domain, nil) @expires = args.fetch(:expires, nil) @name = args.fetch(:name, nil) @path = args.fetch(:path, nil) @ports = args.fetch(:ports, nil) @value = args.fetch(:value, nil) @secure = args.fetch(:secure, nil) @persistent = args.fetch(:persistent, nil) @spec_version = args.fetch(:spec_version, nil) end # @param date [Time] Time to compare against # # @return [Boolean] Whether this cookie is expired at the comparison date def expired?(date = Time.now) @expiry_date > date end # Whether this is a HTTPS-only cookie # # @return [Boolean] def secure? @secure end # Whether this is a persistent (session-only) cookie # # @return [Boolean] def persistent? @persistent end # Whether this is a session-only cookie # # @return [Boolean] def session? !@persistent end end |
#spec_version ⇒ Integer (readonly)
Returns the version of the cookie specification to which this cookie conforms.
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/manticore/cookie.rb', line 20 class Cookie # @private # Create a Manticore::Cookie wrapper from a org.apache.http.cookie.Cookie def self.from_java() if .get_expiry_date expiry = Time.at(.get_expiry_date / 1000) end new( comment: .get_comment, comment_url: .getCommentURL, domain: .get_domain, expires: expiry, name: .get_name, path: .get_path, ports: .get_ports.to_a, value: .get_value, secure: .is_secure, persistent: .is_persistent, spec_version: .get_version ) end def self.(value) opts = {name: nil, value: nil} value.split(";").each do |part| k, v = part.split("=", 2).map(&:strip) if opts[:name].nil? opts[:name] = k opts[:value] = v end case k.downcase when "domain", "path" opts[k.to_sym] = v when "secure" opts[:secure] = true end end Manticore::Cookie.new opts end attr_reader :comment, :comment_url, :domain, :expires, :name, :path, :ports, :value, :spec_version def initialize(args) @comment = args.fetch(:comment, nil) @comment_url = args.fetch(:comment_url, nil) @domain = args.fetch(:domain, nil) @expires = args.fetch(:expires, nil) @name = args.fetch(:name, nil) @path = args.fetch(:path, nil) @ports = args.fetch(:ports, nil) @value = args.fetch(:value, nil) @secure = args.fetch(:secure, nil) @persistent = args.fetch(:persistent, nil) @spec_version = args.fetch(:spec_version, nil) end # @param date [Time] Time to compare against # # @return [Boolean] Whether this cookie is expired at the comparison date def expired?(date = Time.now) @expiry_date > date end # Whether this is a HTTPS-only cookie # # @return [Boolean] def secure? @secure end # Whether this is a persistent (session-only) cookie # # @return [Boolean] def persistent? @persistent end # Whether this is a session-only cookie # # @return [Boolean] def session? !@persistent end end |
#value ⇒ Array<Integer> (readonly)
Returns the cookie value
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/manticore/cookie.rb', line 20 class Cookie # @private # Create a Manticore::Cookie wrapper from a org.apache.http.cookie.Cookie def self.from_java() if .get_expiry_date expiry = Time.at(.get_expiry_date / 1000) end new( comment: .get_comment, comment_url: .getCommentURL, domain: .get_domain, expires: expiry, name: .get_name, path: .get_path, ports: .get_ports.to_a, value: .get_value, secure: .is_secure, persistent: .is_persistent, spec_version: .get_version ) end def self.(value) opts = {name: nil, value: nil} value.split(";").each do |part| k, v = part.split("=", 2).map(&:strip) if opts[:name].nil? opts[:name] = k opts[:value] = v end case k.downcase when "domain", "path" opts[k.to_sym] = v when "secure" opts[:secure] = true end end Manticore::Cookie.new opts end attr_reader :comment, :comment_url, :domain, :expires, :name, :path, :ports, :value, :spec_version def initialize(args) @comment = args.fetch(:comment, nil) @comment_url = args.fetch(:comment_url, nil) @domain = args.fetch(:domain, nil) @expires = args.fetch(:expires, nil) @name = args.fetch(:name, nil) @path = args.fetch(:path, nil) @ports = args.fetch(:ports, nil) @value = args.fetch(:value, nil) @secure = args.fetch(:secure, nil) @persistent = args.fetch(:persistent, nil) @spec_version = args.fetch(:spec_version, nil) end # @param date [Time] Time to compare against # # @return [Boolean] Whether this cookie is expired at the comparison date def expired?(date = Time.now) @expiry_date > date end # Whether this is a HTTPS-only cookie # # @return [Boolean] def secure? @secure end # Whether this is a persistent (session-only) cookie # # @return [Boolean] def persistent? @persistent end # Whether this is a session-only cookie # # @return [Boolean] def session? !@persistent end end |
Class Method Details
.from_java(cookie) ⇒ Object
Create a Manticore::Cookie wrapper from a org.apache.http.cookie.Cookie
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/manticore/cookie.rb', line 23 def self.from_java() if .get_expiry_date expiry = Time.at(.get_expiry_date / 1000) end new( comment: .get_comment, comment_url: .getCommentURL, domain: .get_domain, expires: expiry, name: .get_name, path: .get_path, ports: .get_ports.to_a, value: .get_value, secure: .is_secure, persistent: .is_persistent, spec_version: .get_version ) end |
.from_set_cookie(value) ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/manticore/cookie.rb', line 43 def self.(value) opts = {name: nil, value: nil} value.split(";").each do |part| k, v = part.split("=", 2).map(&:strip) if opts[:name].nil? opts[:name] = k opts[:value] = v end case k.downcase when "domain", "path" opts[k.to_sym] = v when "secure" opts[:secure] = true end end Manticore::Cookie.new opts end |
Instance Method Details
#expired?(date = Time.now) ⇒ Boolean
Returns Whether this cookie is expired at the comparison date.
82 83 84 |
# File 'lib/manticore/cookie.rb', line 82 def expired?(date = Time.now) @expiry_date > date end |
#persistent? ⇒ Boolean
Whether this is a persistent (session-only) cookie
96 97 98 |
# File 'lib/manticore/cookie.rb', line 96 def persistent? @persistent end |
#secure? ⇒ Boolean
Whether this is a HTTPS-only cookie
89 90 91 |
# File 'lib/manticore/cookie.rb', line 89 def secure? @secure end |
#session? ⇒ Boolean
Whether this is a session-only cookie
103 104 105 |
# File 'lib/manticore/cookie.rb', line 103 def session? !@persistent end |