Class: BigIPCookie::Decode
- Inherits:
-
Object
- Object
- BigIPCookie::Decode
- Defined in:
- lib/bigipcookie.rb
Overview
The class to decode BigIP cookies
Instance Attribute Summary collapse
-
#cookie_type ⇒ String
readonly
The type of the cookie.
-
#decoded_cookie ⇒ String
readonly
The decoded cookie value.
-
#pool_name ⇒ String
readonly
The pool name.
-
#raw_cookie ⇒ String
readonly
The raw cookie (as provided).
Instance Method Summary collapse
-
#auto_decode(opts = {}) ⇒ Object
Automatically decode the raw cookie, detects if there is a cookie key (custom or default) or only the value.
-
#initialize(cookie) ⇒ Decode
constructor
A new instance of cookie.
Constructor Details
#initialize(cookie) ⇒ Decode
A new instance of cookie
43 44 45 46 47 48 |
# File 'lib/bigipcookie.rb', line 43 def initialize() @raw_cookie = @pool_name = nil @decoded_cookie = nil @cookie_type = nil end |
Instance Attribute Details
#cookie_type ⇒ String (readonly)
Returns the type of the cookie
39 40 41 |
# File 'lib/bigipcookie.rb', line 39 def @cookie_type end |
#decoded_cookie ⇒ String (readonly)
Returns the decoded cookie value
34 35 36 |
# File 'lib/bigipcookie.rb', line 34 def @decoded_cookie end |
#pool_name ⇒ String (readonly)
Returns the pool name
29 30 31 |
# File 'lib/bigipcookie.rb', line 29 def pool_name @pool_name end |
#raw_cookie ⇒ String (readonly)
Returns the raw cookie (as provided)
26 27 28 |
# File 'lib/bigipcookie.rb', line 26 def @raw_cookie end |
Instance Method Details
#auto_decode(opts = {}) ⇒ Object
Note:
.yardopts-dev must be used to get #decode_ip documentation
Automatically decode the raw cookie, detects if there is a cookie key
(custom or default) or only the value
223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 |
# File 'lib/bigipcookie.rb', line 223 def auto_decode(opts = {}) if /\=/.match?(@raw_cookie) # if there is a key if /^BIGipServer/.match?(@raw_cookie) # if default cookie name pool_name = retrieve_pool_name = /^BIGipServer.+=(.+)/.match(@raw_cookie).captures[0] = (, opts) @pool_name = pool_name else # custom cookie name = /.+=(.+)/.match(@raw_cookie).captures[0] = (, opts) @pool_name = 'unknown' end else # cookie value only = (@raw_cookie, opts) @pool_name = 'unknown' end @decoded_cookie = end |