Class: RedditApi::Users
- Inherits:
-
Object
- Object
- RedditApi::Users
- Defined in:
- lib/reddit_api/users.rb
Constant Summary collapse
- MAX_MISSES =
5
Instance Attribute Summary collapse
-
#misses ⇒ Object
readonly
Returns the value of attribute misses.
Instance Method Summary collapse
-
#initialize(args = {}) ⇒ Users
constructor
A new instance of Users.
- #top_posters(subreddit, count) ⇒ Object
Constructor Details
Instance Attribute Details
#misses ⇒ Object
Returns the value of attribute misses.
5 6 7 |
# File 'lib/reddit_api/users.rb', line 5 def misses @misses end |
Instance Method Details
#top_posters(subreddit, count) ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/reddit_api/users.rb', line 16 def top_posters(subreddit, count) users = {} while users.length < count && misses < MAX_MISSES posts = post_api.top(subreddit, count) collect_users(posts, count, users) update_misses(users.length) end users.values end |