class Engagement::CommentCounter::HackerNews

Public Class Methods

new() click to toggle source
# File lib/engagement/comment_counter/hacker_news.rb, line 4
def initialize
  @client = HackerNewsSearch.new
end

Public Instance Methods

comments_count(url) click to toggle source
# File lib/engagement/comment_counter/hacker_news.rb, line 8
def comments_count(url)
  @client.search("items", url)['results'].inject(0) { |comments_count, result|
    comments_count + result['item']['num_comments']
  }
end