Sha256: 7bc102cd1534b30358e23c86b0efc484f6ac30af18cad096dd0375ff5aaeb18b

Contents?: true

Size: 601 Bytes

Versions: 3

Compression:

Stored size: 601 Bytes

Contents

require 'leaderboard'

module ActivityFeed
  class Feed
    def initialize(user_id)
      @feederboard = Leaderboard.new("#{ActivityFeed.namespace}:#{ActivityFeed.key}:#{user_id}", Leaderboard::DEFAULT_OPTIONS, {:redis_connection => ActivityFeed.redis})
    end
    
    def page(page)
      feed_items = []
      @feederboard.leaders(page).each do |feed_item|
        feed_items << ActivityFeed.load_item(feed_item[:member])
      end

      feed_items
    end
    
    def total_pages
      @feederboard.total_pages
    end
    
    def total_items
      @feederboard.total_members
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
activity_feed-1.1.1 lib/activity_feed/feed.rb
activity_feed-1.1.0 lib/activity_feed/feed.rb
activity_feed-1.0.0 lib/activity_feed/feed.rb