Module: LHS::Record::Pagination::ClassMethods
- Defined in:
- lib/lhs/concerns/record/pagination.rb
Instance Method Summary collapse
-
#paginated?(raw) ⇒ Boolean
Checks if given raw is paginated or not.
- #pagination(data) ⇒ Object
- #pagination_class ⇒ Object
Instance Method Details
#paginated?(raw) ⇒ Boolean
Checks if given raw is paginated or not
39 40 41 42 43 44 |
# File 'lib/lhs/concerns/record/pagination.rb', line 39 def paginated?(raw) raw.is_a?(Hash) && ( raw.dig(*total_key).present? || raw.dig(*limit_key(:body)).present? ) end |
#pagination(data) ⇒ Object
34 35 36 |
# File 'lib/lhs/concerns/record/pagination.rb', line 34 def pagination(data) pagination_class.new(data) end |
#pagination_class ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 |
# 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 when :link LHS::Pagination::Link else LHS::Pagination::Offset end end |