Sha256: 71bc923ee54b062c40077a2fe401c32472b3f2589d9228cbeec970927001c596

Contents?: true

Size: 596 Bytes

Versions: 1

Compression:

Stored size: 596 Bytes

Contents

# frozen_string_literal: true

module CurrentSession
  #
  # repository to return the user specified by the environment variable
  #
  class EnvSession < Repository
    # rubocop:disable Metrics/MethodLength
    def self.build(current_user_id)
      Class.new(Repository) 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

Version data entries

1 entries across 1 versions & 1 rubygems

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