module ActsAsHocUser

Constants

LOCK
VERSION

Public Class Methods

configuration() click to toggle source
# File lib/acts_as_hoc_user.rb, line 17
def configuration
  @configuration = nil unless defined?(@configuration)
  @configuration || LOCK.synchronize { @configuration ||= ActsAsHocUser::Configuration.new }
end
configure(config_hash=nil) { |configuration| ... } click to toggle source
# File lib/acts_as_hoc_user.rb, line 7
def configure(config_hash=nil)
  if config_hash
    config_hash.each do |k,v|
      configuration.send("#{k}=", v) rescue nil if configuration.respond_to?("#{k}=")
    end
  end

  yield(configuration) if block_given?
end

Public Instance Methods

authentication_token(expiration = 14.days.from_now) click to toggle source
# File lib/acts_as_hoc_user/acts_as_hoc_user.rb, line 8
def authentication_token(expiration = 14.days.from_now)
  JsonWebToken.encode({ user_id: id }, expiration)
end