Sha256: c6807982770d3d181302d2156cb2d29a48e0c8914589985e46618bfe8e8f47af

Contents?: true

Size: 554 Bytes

Versions: 1

Compression:

Stored size: 554 Bytes

Contents

# frozen_string_literal: true

require_relative './base_processor'
require_relative './paginate/enumerable_adapter'

class ActiveSet
  class PaginateProcessor < BaseProcessor
    def process
      output = adapter.new(@set, instruction).process
      output[:set]
    end

    private

    def adapter
      EnumerableAdapter
    end

    def instruction
      Instructions::Entry.new(page_number, pagesize)
    end

    def page_number
      @instructions.get(:page) || 1
    end

    def pagesize
      @instructions.get(:size) || 25
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
activeset-0.5.1 lib/active_set/processors/paginate_processor.rb