Module: LHS::Record::Pagination::ClassMethods

Defined in:
lib/lhs/concerns/record/pagination.rb

Instance Method Summary collapse

Instance Method Details

#paginated?(raw) ⇒ Boolean

Checks if given raw is paginated or not

Returns:

  • (Boolean)


37
38
39
# File 'lib/lhs/concerns/record/pagination.rb', line 37

def paginated?(raw)
  !!(raw.is_a?(Hash) && raw.dig(*total_key))
end

#pagination(data) ⇒ Object



32
33
34
# File 'lib/lhs/concerns/record/pagination.rb', line 32

def pagination(data)
  pagination_class.new(data)
end

#pagination_classObject



21
22
23
24
25
26
27
28
29
30
# File 'lib/lhs/concerns/record/pagination.rb', line 21

def pagination_class
  case pagination_strategy.to_sym
  when :page
    LHS::Pagination::Page
  when :start
    LHS::Pagination::Start
  else
    LHS::Pagination::Offset
  end
end