Class: Engagement::CommentCounter

Inherits:
Object
  • Object
show all
Defined in:
lib/engagement/comment_counter.rb,
lib/engagement/comment_counter/disqus.rb,
lib/engagement/comment_counter/twitter.rb

Defined Under Namespace

Classes: Disqus, HackerNews, Reddit, Threaded, Twitter

Instance Method Summary collapse

Constructor Details

#initialize(places) ⇒ CommentCounter

Returns a new instance of CommentCounter.



10
11
12
# File 'lib/engagement/comment_counter.rb', line 10

def initialize(places)
  @places = places
end

Instance Method Details

#comments_count(url) ⇒ Object



14
15
16
17
18
# File 'lib/engagement/comment_counter.rb', line 14

def comments_count(url)
  @places.inject(0) do |comments_count, place|
    comments_count + place.comments_count(url)
  end
end