Sha256: 75d0ca5ffbff1571b6a356f7c4fd2f32a9128f0ee1454f0d5a49ca0678e2785b
Contents?: true
Size: 1007 Bytes
Versions: 10
Compression:
Stored size: 1007 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 session_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
10 entries across 10 versions & 1 rubygems