Sha256: 44d6b88af7c322cb9f1b10551eab0a8c6eb0fc57e539826189064ec6c87804fe

Contents?: true

Size: 556 Bytes

Versions: 1

Compression:

Stored size: 556 Bytes

Contents

require 'active_support/core_ext/module/delegation'

module NextPageable
  class Page
    include Enumerable

    attr_reader :collection
    attr_reader :next_page_index

    def initialize(collection:, next_page_index:)
      @collection = collection
      @next_page_index = next_page_index
    end

    delegate :each, to: :collection
    delegate :to_ary, to: :collection
    delegate :to_a, to: :collection
    delegate :size, to: :collection
    delegate :length, to: :collection

    def next_page?
      next_page_index.present?
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
next-pageable-0.1.3 lib/next-pageable/page.rb