Module: CurrentSession::SessionMethods::EnvSession

Defined in:
lib/current_session/session_methods/env_session.rb

Overview

repository to return the user specified by the environment variable

Class Method Summary collapse

Class Method Details

.build(current_user_id) ⇒ Object

rubocop:disable Metrics/MethodLength



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/current_session/session_methods/env_session.rb', line 10

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