Sha256: e6c3ff60a0e1d9bc48206288c0c2e4197a99dc84c63effff89cd3f7d2108dede
Contents?: true
Size: 1.01 KB
Versions: 14
Compression:
Stored size: 1.01 KB
Contents
# frozen_string_literal: true module Cmor module Legal class CookieStore attr_accessor :cookies def initialize(store) @store = store end def self.cookie_prefix ::Cmor::Legal::Configuration.cookie_prefix end def self.add_prefix_to_identifier(identifier) "#{cookie_prefix}#{identifier}" end def get_value(identifier) @store[self.class.add_prefix_to_identifier(identifier)] end def set_value(identifier, value, expires = nil) if @store.is_a?(ActionDispatch::Cookies::CookieJar) @store[self.class.add_prefix_to_identifier(identifier)] = { value: value, expires: expires } else @store[self.class.add_prefix_to_identifier(identifier)] = value end end def cookies @store.select { |key, value| key.to_s.start_with?(self.class.cookie_prefix) }.each_with_object({}) do |(k, v), m| m[k.gsub(self.class.cookie_prefix, "")] = v end end end end end
Version data entries
14 entries across 14 versions & 1 rubygems