Class: CookieMonster::Jar
Instance Attribute Summary collapse
-
#cookies ⇒ Object
readonly
Returns the value of attribute cookies.
Instance Method Summary collapse
- #[](key) ⇒ Object
- #[]=(key, value_or_options) ⇒ Object
-
#initialize(cookies) ⇒ Jar
constructor
A new instance of Jar.
Constructor Details
#initialize(cookies) ⇒ Jar
Returns a new instance of Jar.
5 6 7 |
# File 'lib/cookie_monster/jar.rb', line 5 def initialize() @cookies = end |
Instance Attribute Details
#cookies ⇒ Object (readonly)
Returns the value of attribute cookies.
3 4 5 |
# File 'lib/cookie_monster/jar.rb', line 3 def @cookies end |
Instance Method Details
#[](key) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/cookie_monster/jar.rb', line 9 def [](key) if @cookies[key] = @cookies[key] else return nil end if .is_a? Hash = [:value] end encrypted = Encryption.new() encrypted.decrypt end |
#[]=(key, value_or_options) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/cookie_monster/jar.rb', line 24 def []=(key, ) value, = ||= {} encrypted_value = Encryption.new(value).encrypt @cookies[key] = { :value => encrypted_value, :httponly => [:httponly], :expires => [:expires], :domain => [:domain], :path => [:path] || '/', :secure => false # Needed so it can be read by cookie logger over http } end |