Sha256: 2fe3e82429a314535d05c6c38b9bd39d8e7118ca4a588c3ef2d1aea366a652f1
Contents?: true
Size: 1008 Bytes
Versions: 3
Compression:
Stored size: 1008 Bytes
Contents
# frozen_string_literal: true module Hanami class Action # Session support for actions. # # Not included by default; you should include this module manually to enable session support. # For actions within an Hanami app, this module will be included automatically if sessions are # configured in the app config. # # @api public # @since 0.1.0 module Session # @api private # @since 0.1.0 def self.included(base) base.class_eval do before { |req, _| req.id } end end private def sessions_enabled? true end # Finalize the response # # @return [void] # # @since 0.3.0 # @api private # # @see Hanami::Action#finish def finish(req, res, *) if (next_flash = res.flash.next).any? res.session[Flash::KEY] = next_flash else res.session.delete(Flash::KEY) end super end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
hanami-controller-2.0.2 | lib/hanami/action/session.rb |
hanami-controller-2.0.1 | lib/hanami/action/session.rb |
hanami-controller-2.0.0 | lib/hanami/action/session.rb |