Sha256: 4afedd8937b8908d29787e09d865d8b81b760596669f96a0768856d085ddc28a
Contents?: true
Size: 950 Bytes
Versions: 4
Compression:
Stored size: 950 Bytes
Contents
require 'leaderboard' module ActivityFeed class Feed def initialize(user_id) @feederboard = Leaderboard.new(ActivityFeed.feed_key(user_id), Leaderboard::DEFAULT_OPTIONS, {:redis_connection => ActivityFeed.redis}) @feederboard_aggregate = Leaderboard.new(ActivityFeed.feed_key(user_id, true), Leaderboard::DEFAULT_OPTIONS, {:redis_connection => ActivityFeed.redis}) end def page(page, aggregate = false) feed_items = [] feed = aggregate ? @feederboard_aggregate : @feederboard feed.leaders(page).each do |feed_item| feed_items << ActivityFeed.load_item(feed_item[:member]) end feed_items end def total_pages(aggregate = false) aggregate ? @feederboard_aggregate.total_pages : @feederboard.total_pages end def total_items(aggregate = false) aggregate ? @feederboard_aggregate.total_members : @feederboard.total_members end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
activity_feed-1.4.0 | lib/activity_feed/feed.rb |
activity_feed-1.3.0 | lib/activity_feed/feed.rb |
activity_feed-1.2.1 | lib/activity_feed/feed.rb |
activity_feed-1.2 | lib/activity_feed/feed.rb |