Class: User

Inherits:
Object
  • Object
show all
Includes:
DmAdapter, MmAdapter, MongoidAdapter, SequelAdapter, TcAdapter
Defined in:
lib/models/abstract_user.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from MongoidAdapter

included

Methods included from SequelAdapter

included

Methods included from MmAdapter

included

Methods included from TcAdapter

included

Methods included from DmAdapter

included

Constructor Details

#initialize(interfacing_class_instance) ⇒ User

Returns a new instance of User.



36
37
38
# File 'lib/models/abstract_user.rb', line 36

def initialize(interfacing_class_instance)
  @instance = interfacing_class_instance
end

Class Method Details

.authenticate(email, pass) ⇒ Object



44
45
46
47
48
49
# File 'lib/models/abstract_user.rb', line 44

def self.authenticate(email, pass)
  current_user = get(:email => email)
  return nil if current_user.nil?
  return current_user if User.encrypt(pass, current_user.salt) == current_user.hashed_password
  nil
end

Instance Method Details

#db_instanceObject



51
52
53
# File 'lib/models/abstract_user.rb', line 51

def db_instance
  @instance
end

#idObject



40
41
42
# File 'lib/models/abstract_user.rb', line 40

def id
  @instance.id
end