Sha256: 8a45fb8786c0354af4beb9fc819d57e9c44fb4109d79b1ff8eee25e34a622907

Contents?: true

Size: 793 Bytes

Versions: 1

Compression:

Stored size: 793 Bytes

Contents

# frozen_string_literal: true

module CurrentSession
  #
  # Base class for implementing current_user
  #
  class Base < ActiveSupport::CurrentAttributes
    include CurrentSession::Interface
    include CurrentSession::RaiseNotImplementedError
    attribute :current_user

    class << self
      attr_accessor :user_class, :session_token_class

      def current_time(_)
        Time.current
      end

      def session_repository_class=(session_repository_class = nil)
        @session_repository_class = session_repository_class
      end

      def session_methods(&block)
        @session_repository_class = Class.new(CurrentSession::Repository, &block)
      end

      def auth_methods(&block)
        @auth_class = Class.new(CurrentSession::Auth, &block)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
current_session-0.1.0 lib/current_session/base.rb