Class: CookieMonster::Cookie
- Inherits:
-
Object
- Object
- CookieMonster::Cookie
- Defined in:
- lib/cookiemonster.rb
Instance Attribute Summary collapse
-
#domain ⇒ Object
readonly
Returns the value of attribute domain.
-
#expires ⇒ Object
readonly
Returns the value of attribute expires.
-
#http_only ⇒ Object
(also: #http_only?)
readonly
Returns the value of attribute http_only.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#secure ⇒ Object
(also: #secure?)
readonly
Returns the value of attribute secure.
-
#session ⇒ Object
(also: #session?)
readonly
Returns the value of attribute session.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #expired? ⇒ Boolean
-
#initialize(args) ⇒ Cookie
constructor
A new instance of Cookie.
Constructor Details
#initialize(args) ⇒ Cookie
Returns a new instance of Cookie.
45 46 47 48 49 50 51 52 53 54 |
# File 'lib/cookiemonster.rb', line 45 def initialize(args) @name = args[:name] @value = args[:value] @path = args[:path] @domain = args[:domain] @expires = args[:expires] ? parse_expiry(args[:expires]) : nil @http_only = args.has_key?(:httponly) ? true : false @secure = args.has_key?(:secure) ? true : false @session = expires.nil? end |
Instance Attribute Details
#domain ⇒ Object (readonly)
Returns the value of attribute domain.
35 36 37 |
# File 'lib/cookiemonster.rb', line 35 def domain @domain end |
#expires ⇒ Object (readonly)
Returns the value of attribute expires.
36 37 38 |
# File 'lib/cookiemonster.rb', line 36 def expires @expires end |
#http_only ⇒ Object (readonly) Also known as: http_only?
Returns the value of attribute http_only.
37 38 39 |
# File 'lib/cookiemonster.rb', line 37 def http_only @http_only end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
32 33 34 |
# File 'lib/cookiemonster.rb', line 32 def name @name end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
34 35 36 |
# File 'lib/cookiemonster.rb', line 34 def path @path end |
#secure ⇒ Object (readonly) Also known as: secure?
Returns the value of attribute secure.
38 39 40 |
# File 'lib/cookiemonster.rb', line 38 def secure @secure end |
#session ⇒ Object (readonly) Also known as: session?
Returns the value of attribute session.
39 40 41 |
# File 'lib/cookiemonster.rb', line 39 def session @session end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
33 34 35 |
# File 'lib/cookiemonster.rb', line 33 def value @value end |
Instance Method Details
#expired? ⇒ Boolean
56 57 58 59 |
# File 'lib/cookiemonster.rb', line 56 def expired? return false unless expires Time.now > expires end |