Sha256: e8345bde692a90714f4ef42c67ab69a61c2b6616211b49df652c13c9220f109a

Contents?: true

Size: 396 Bytes

Versions: 7

Compression:

Stored size: 396 Bytes

Contents

class Sinbotra::Bot
  class UserRepo
    class << self
      def connect
        @users ||= {}
      end

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

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

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
sinbotra-0.1.6 lib/sinbotra/bot/user_repo.rb
sinbotra-0.1.5 lib/sinbotra/bot/user_repo.rb
sinbotra-0.1.4 lib/sinbotra/bot/user_repo.rb
sinbotra-0.1.3 lib/sinbotra/bot/user_repo.rb
sinbotra-0.1.2 lib/sinbotra/bot/user_repo.rb
sinbotra-0.1.1 lib/sinbotra/bot/user_repo.rb
sinbotra-0.1.0 lib/sinbotra/bot/user_repo.rb