Sha256: 3451ea2517269ca61c2c32f71b6a981e79ff899e82756dedb1a9ac8f088c6436

Contents?: true

Size: 647 Bytes

Versions: 4

Compression:

Stored size: 647 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
            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

4 entries across 4 versions & 1 rubygems

Version Path
current_session-0.1.5 lib/current_session/session_methods/env_session.rb
current_session-0.1.4 lib/current_session/session_methods/env_session.rb
current_session-0.1.3 lib/current_session/session_methods/env_session.rb
current_session-0.1.2 lib/current_session/session_methods/env_session.rb