Module: ParamsReady::Pagination::Direction::After

Extended by:
ParamsReady::Pagination::Direction
Defined in:
lib/params_ready/pagination/direction.rb

Class Method Summary collapse

Methods included from ParamsReady::Pagination::Direction

build_cursor, check_primary_keys_presence, cursor_predicate, cursor_predicates, instance, non_nullable_predicate, nullable_predicate, pk_predicate

Class Method Details

.invert_ordering?Boolean

Returns:

  • (Boolean)


120
121
122
# File 'lib/params_ready/pagination/direction.rb', line 120

def self.invert_ordering?
  false
end

.keysets(last, keysets, &block) ⇒ Object



142
143
144
# File 'lib/params_ready/pagination/direction.rb', line 142

def self.keysets(last, keysets, &block)
  AfterKeysets.new(last, keysets, &block)
end

.nulls_strategy(strategy) ⇒ Object



133
134
135
136
137
138
139
140
# File 'lib/params_ready/pagination/direction.rb', line 133

def self.nulls_strategy(strategy)
  case strategy
  when :first then Nulls::First
  when :last then Nulls::Last
  else
    raise ParamsReadyError, "Unexpected nulls strategy: '#{strategy}'"
  end
end

.tendency(ordering) ⇒ Object



124
125
126
127
128
129
130
131
# File 'lib/params_ready/pagination/direction.rb', line 124

def self.tendency(ordering)
  case ordering
  when :asc then Tendency::Growing
  when :desc then Tendency::Falling
  else
    raise ParamsReadyError, "Unexpected ordering: '#{ordering}'"
  end
end