Class: CookiePlugin
- Inherits:
-
Rubko::Plugin
- Object
- Rubko::Plugin
- CookiePlugin
- Defined in:
- lib/rubko/plugins/cookie.rb
Instance Attribute Summary collapse
-
#domain ⇒ Object
Returns the value of attribute domain.
-
#expires ⇒ Object
Returns the value of attribute expires.
-
#httpOnly ⇒ Object
Returns the value of attribute httpOnly.
-
#maxAge ⇒ Object
Returns the value of attribute maxAge.
-
#path ⇒ Object
Returns the value of attribute path.
-
#secure ⇒ Object
Returns the value of attribute secure.
Attributes included from Rubko::Base
Instance Method Summary collapse
Methods inherited from Rubko::Plugin
Methods included from Rubko::Base
#camelize, #finalize, #httpGet, #initialize, #jsonParse, #loadController, #loadFile, #loadModel, #loadPlugin, #loadView, #method_missing, #uncamelize
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Rubko::Base
Instance Attribute Details
#domain ⇒ Object
Returns the value of attribute domain.
13 14 15 |
# File 'lib/rubko/plugins/cookie.rb', line 13 def domain @domain end |
#expires ⇒ Object
Returns the value of attribute expires.
13 14 15 |
# File 'lib/rubko/plugins/cookie.rb', line 13 def expires @expires end |
#httpOnly ⇒ Object
Returns the value of attribute httpOnly.
13 14 15 |
# File 'lib/rubko/plugins/cookie.rb', line 13 def httpOnly @httpOnly end |
#maxAge ⇒ Object
Returns the value of attribute maxAge.
13 14 15 |
# File 'lib/rubko/plugins/cookie.rb', line 13 def maxAge @maxAge end |
#path ⇒ Object
Returns the value of attribute path.
13 14 15 |
# File 'lib/rubko/plugins/cookie.rb', line 13 def path @path end |
#secure ⇒ Object
Returns the value of attribute secure.
13 14 15 |
# File 'lib/rubko/plugins/cookie.rb', line 13 def secure @secure end |
Instance Method Details
#[](key = nil) ⇒ Object
32 33 34 |
# File 'lib/rubko/plugins/cookie.rb', line 32 def [](key = nil) key.nil? ? : [key] end |
#[]=(key, val) ⇒ Object
36 37 38 39 40 41 42 43 44 |
# File 'lib/rubko/plugins/cookie.rb', line 36 def []=(key, val) if val.nil? Rack::Utils. headers, key, domain: domain, path: path else Rack::Utils. headers, key, value: val, domain: domain, path: path, httponly: httpOnly, secure: secure, max_age: maxAge.to_s, expires: expires end val end |
#init ⇒ Object
2 3 4 5 6 7 8 9 10 11 |
# File 'lib/rubko/plugins/cookie.rb', line 2 def init @domain = nil @path = url.base @httpOnly = true @secure = false @maxAge = 30*24*60*60 @expires = nil config end |
#ip ⇒ Object
28 29 30 |
# File 'lib/rubko/plugins/cookie.rb', line 28 def ip Rack::Request.new(env).ip.encode 'UTF-8' end |