Sha256: ad4f52684420a97308af79a856c6296973bf2400716704912e5bc8abb7d5af61
Contents?: true
Size: 956 Bytes
Versions: 1
Compression:
Stored size: 956 Bytes
Contents
# frozen_string_literal: true require "hanami/utils/string" require "hanami/utils/class" module Hanami class Config # Hanami config for HTTP sessions # # @since 2.0.0 class Sessions NULL_SESSION_OPTION = :null private_constant :NULL_SESSION_OPTION def self.null self.class.new(NULL_SESSION_OPTION) end attr_reader :storage, :options def initialize(*args) storage, options, = Array(args.dup).flatten @storage = storage @options = options || {} end def enabled? storage != NULL_SESSION_OPTION end def middleware [storage_middleware, options] end private def storage_middleware require_storage name = Utils::String.classify(storage) Utils::Class.load!(name, Rack::Session) end def require_storage require "rack/session/#{storage}" end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
hanami-2.0.0.beta4 | lib/hanami/config/sessions.rb |