Class: SWS::Cookie
- Inherits:
-
Object
- Object
- SWS::Cookie
- Defined in:
- lib/sws/cookie.rb
Overview
Represents HTML cookie
Instance Attribute Summary collapse
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(key, value, path = "/") ⇒ Cookie
constructor
Creates new Cookie with given key=value pair and optionally path.
-
#to_s ⇒ Object
Returns cookie representation in HTTP header form.
Constructor Details
#initialize(key, value, path = "/") ⇒ Cookie
Creates new Cookie with given key=value pair and optionally path
15 16 17 |
# File 'lib/sws/cookie.rb', line 15 def initialize ( key, value, path="/" ) @key,@value,@path = key,value,path end |
Instance Attribute Details
#key ⇒ Object (readonly)
Returns the value of attribute key.
8 9 10 |
# File 'lib/sws/cookie.rb', line 8 def key @key end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
10 11 12 |
# File 'lib/sws/cookie.rb', line 10 def path @path end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
9 10 11 |
# File 'lib/sws/cookie.rb', line 9 def value @value end |
Instance Method Details
#to_s ⇒ Object
Returns cookie representation in HTTP header form
21 22 23 |
# File 'lib/sws/cookie.rb', line 21 def to_s return "Set-Cookie: #{@key}=#{@value}; path=#{@path}" end |