Class: Sinbotra::Bot::UserRepo

Inherits:
Object
  • Object
show all
Defined in:
lib/sinbotra/bot/user_repo.rb

Class Method Summary collapse

Class Method Details

.connectObject



4
5
6
# File 'lib/sinbotra/bot/user_repo.rb', line 4

def connect
  @users ||= {}
end

.find_or_create(user_class, id) ⇒ Object



8
9
10
11
12
13
14
15
# File 'lib/sinbotra/bot/user_repo.rb', line 8

def find_or_create(user_class, id)
  user = @users[id]
  if user.nil?
    user = user_class.new(id)
    @users[id] = user
  end
  user
end

.messages(id) ⇒ Object



17
18
19
20
# File 'lib/sinbotra/bot/user_repo.rb', line 17

def messages(id)
  user = @users[id]
  user.history.all
end