Sha256: d46289804ed24bc73459edb7c995801b9ae5e0194308e28cbbe1c16831c83929

Contents?: true

Size: 699 Bytes

Versions: 4

Compression:

Stored size: 699 Bytes

Contents

require 'current_user/constants'
require 'current_user/controller/helpers'
require 'current_user/engine'

module CurrentUser
  def self.setup
    yield self
  end

  mattr_accessor :authentication_key

  mattr_accessor :identifier

  def identifier_for(user)
    identifier = ::CurrentUser.identifier

    if identifier.respond_to? :call
      identifier.call user
    else
      user.send identifier
    end
  end
  module_function :identifier_for

  def read_authentication_key
    key_file_path = File.expand_path 'config/current_user/key', Rails.root
    if File.exist? key_file_path
      File.open(key_file_path) { |f| f.readline }
    end
  end
  module_function :read_authentication_key
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
current_user-0.2.1 lib/current_user.rb
current_user-0.2.0 lib/current_user.rb
current_user-0.1.0 lib/current_user.rb
current_user-0.0.1 lib/current_user.rb