Class: RedditApi::Users

Inherits:
Object
  • Object
show all
Defined in:
lib/reddit_api/users.rb

Instance Method Summary collapse

Constructor Details

#initializeUsers

Returns a new instance of Users.


5
6
7
8
# File 'lib/reddit_api/users.rb', line 5

def initialize
  @post_api = RedditApi::Posts.new
  @user_factory = RedditApi::User
end

Instance Method Details

#top_posters(subreddit, count) ⇒ Object


10
11
12
13
14
15
16
17
# File 'lib/reddit_api/users.rb', line 10

def top_posters(subreddit, count)
  users = {}
  while users.length < count
    posts = post_api.top(subreddit, count)
    collect_users(posts, count, users)
  end
  users.values
end