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
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_class ⇒ Object
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 |