Class: RedditApi::Comments
- Inherits:
-
Object
- Object
- RedditApi::Comments
- Defined in:
- lib/reddit_api/comments.rb
Instance Method Summary collapse
-
#initialize ⇒ Comments
constructor
A new instance of Comments.
- #most_recent_comments(user, count = 100) ⇒ Object
- #most_recent_subreddits(user, count) ⇒ Object
Constructor Details
#initialize ⇒ Comments
Returns a new instance of Comments.
5 6 7 8 |
# File 'lib/reddit_api/comments.rb', line 5 def initialize @client = RedditApi::Client.new @comment_factory = RedditApi::Comment end |
Instance Method Details
#most_recent_comments(user, count = 100) ⇒ Object
19 20 21 22 |
# File 'lib/reddit_api/comments.rb', line 19 def most_recent_comments(user, count = 100) comments_data = most_recent_comment_data(user.username, count) build_all_comments(comments_data) end |
#most_recent_subreddits(user, count) ⇒ Object
10 11 12 13 14 15 16 17 |
# File 'lib/reddit_api/comments.rb', line 10 def most_recent_subreddits(user, count) subreddits = {} while subreddits.length < count comments = most_recent_comments(user) collect_subreddits(comments, count, subreddits) end subreddits.keys end |