Class: RedditApi::Users
- Inherits:
-
Object
- Object
- RedditApi::Users
- Defined in:
- lib/reddit_api/users.rb
Instance Method Summary collapse
-
#initialize ⇒ Users
constructor
A new instance of Users.
- #top_posters(subreddit, count) ⇒ Object
Constructor Details
#initialize ⇒ Users
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 |