Sha256: f5678d8f59bc71469928755782afa48057fe9a102a475056a466fa01b49da73d
Contents?: true
Size: 912 Bytes
Versions: 5
Compression:
Stored size: 912 Bytes
Contents
# frozen_string_literal: true require "dry/core/constants" require "hanami/utils/string" require "hanami/utils/class" module Hanami class Configuration class Actions # 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