/usr/lib/ruby/vendor_ruby/moneta/adapters/cookie.rb is in ruby-moneta 0.7.20-2.2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | module Moneta
module Adapters
# Cookie backend used by the middleware {Rack::MonetaCookies}
# @api public
class Cookie < Memory
attr_reader :cookies
def initialize(options = {})
super
@options, @cookies = options, {}
end
# (see Proxy#store)
def store(key, value, options = {})
cookie = @options.merge(options)
cookie[:value] = value
cookie[:expires] += Time.now.to_i if cookie[:expires]
@cookies[key] = cookie
super
end
# (see Proxy#delete)
def delete(key, options = {})
@cookies[key] = nil
super
end
# (see Proxy#clear)
def clear(options = {})
@backend.each_key { |key| @cookies[key] = nil }
super
self
end
# Reset the cookie store
# This method is used by the middleware.
def reset(cookies)
@cookies, @backend = {}, cookies
end
end
end
end
|