Sha256: b0fbd8009f2593c0bbfa9e5c522162fd419f4774cb434c741bb09ddf58bef47a
Contents?: true
Size: 858 Bytes
Versions: 5
Compression:
Stored size: 858 Bytes
Contents
# frozen_string_literal: true module DuodealerApp class SessionRepository class ConfigurationError < StandardError; end class << self def storage=(storage) @storage = storage unless storage.nil? || self.storage.respond_to?(:store) && self.storage.respond_to?(:retrieve) raise ArgumentError, "storage must respond to :store and :retrieve" end end delegate :retrieve, to: :storage def store(session, *args) storage.store(session, *args) end def storage load_storage || raise(ConfigurationError.new("DuodealerSessionRepository.storage is not configured!")) end private def load_storage return unless @storage @storage.respond_to?(:safe_constantize) ? @storage.safe_constantize : @storage end end end end
Version data entries
5 entries across 5 versions & 1 rubygems