class ParamsReady::Pagination::CursorBuilder

Public Class Methods

new(keyset, arel_table, context) click to toggle source
# File lib/params_ready/pagination/cursor.rb, line 7
def initialize(keyset, arel_table, context)
  @keyset = keyset.freeze
  @arel_table = arel_table
  @context = context
  @select_list = []
end

Public Instance Methods

add(key, column) click to toggle source
# File lib/params_ready/pagination/cursor.rb, line 14
def add(key, column)
  attribute = if @keyset.key? key
    Literal.new(key, @keyset[key], column.pk)
  else
    Selector.new(key, column)
  end

  @select_list << attribute
end
build() click to toggle source
# File lib/params_ready/pagination/cursor.rb, line 24
def build
  cursor = Cursor.new(@select_list, @arel_table, @context)
  @select_list = nil
  freeze
  cursor
end