Class: Engagement::CommentCounter

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

Defined Under Namespace

Classes: Disqus, HackerNews, Reddit, Threaded

Instance Method Summary collapse

Constructor Details

#initialize(places) ⇒ CommentCounter

Returns a new instance of CommentCounter.



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

def initialize(places)
  @places = places
end

Instance Method Details

#comments_count(url) ⇒ Object



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

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