Sha256: 234fd66fec9d71c077a26b1d99bc64e6e856f4a1f206029eedf3a11e23245323

Contents?: true

Size: 661 Bytes

Versions: 1

Compression:

Stored size: 661 Bytes

Contents

# frozen_string_literal: true

module CurrentSession
  module SessionMethods
    #
    # repository to return the user specified by the environment variable
    #
    module EnvSession
      # rubocop:disable Metrics/MethodLength
      def self.build(current_user_id)
        Module.new do
          define_method(:current_user) { user_class.find(current_user_id) }

          def try_session_token
            yield self
          end

          def find
            yield current_user
          end

          def create(_)
          end

          def destroy
          end
        end
      end
      # rubocop:enable Metrics/MethodLength
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
current_session-0.1.6 lib/current_session/session_methods/env_session.rb