Sha256: 2664e1455e26d0a76eea7da911aeb86c25a3937f92ca20b16aa7a7c437082c48
Contents?: true
Size: 922 Bytes
Versions: 5
Compression:
Stored size: 922 Bytes
Contents
# frozen_string_literal: true require "dry/core/constants" require "hanami/utils/string" require "hanami/utils/class" module Hanami class Action class ApplicationConfiguration # Configuration for HTTP sessions in Hanami actions # # @since 2.0.0 class Sessions attr_reader :storage, :options def initialize(storage = nil, *options) @storage = storage @options = options end def enabled? !storage.nil? end def middleware return [] if !enabled? [[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 end
Version data entries
5 entries across 5 versions & 1 rubygems