Class: PopularEntries
- Inherits:
-
Object
- Object
- PopularEntries
- Defined in:
- app/services/popular_entries.rb
Class Method Summary collapse
Class Method Details
.month(count) ⇒ Object
17 18 19 |
# File 'app/services/popular_entries.rb', line 17 def self.month(count) Post.of_type('blog_post').visible.posted_after(1.month.ago).popular.first(count) end |
.overall(count) ⇒ Object
22 23 24 |
# File 'app/services/popular_entries.rb', line 22 def self.overall(count) Post.of_type('blog_post').visible.popular.first(count) end |
.prepare(count = 5) ⇒ Object
3 4 5 6 7 8 9 |
# File 'app/services/popular_entries.rb', line 3 def self.prepare(count = 5) { week: week(count), month: month(count), overall: overall(count) } end |
.week(count) ⇒ Object
12 13 14 |
# File 'app/services/popular_entries.rb', line 12 def self.week(count) Post.of_type('blog_post').visible.posted_after(7.days.ago).popular.first(count) end |