summaryrefslogtreecommitdiff
path: root/fake-service/lib/smail/paginate.rb
blob: 85d09196a13575f16caf3565c465371595eb1669 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

module Smail
  class Paginate
    def initialize(page, window_size)
      @start = page * window_size
      @end   = (page + 1) * window_size
    end

    def restrict(input)
      PaginatedEnumerable.new(input, @start, @end)
    end
  end
end

require 'smail/paginated_enumerable'