module Shamu::Entities::ListScope::Paging

Include paging parsing and attributes. Adds the following attributes to the list scope:

“` class UsersListScope < Shamu::Entities::ListScope

include Shamu::Entities::ListScope::Paging

end

scope = UsersListScope.coerce!( params ) scope.page # => 1 scope.per_page # => 25 “`

Public Class Methods

included( base ) click to toggle source

@!endgroup Attributes

Calls superclass method
# File lib/shamu/entities/list_scope/paging.rb, line 35
def self.included( base )
  super

  base.attribute :page, coerce: :to_i
  base.attribute :per_page, coerce: :to_i, default: ->() { default_per_page }
  base.attribute :default_per_page, coerce: :to_i, serialize: false
end

Public Instance Methods

paged?() click to toggle source

@return [Boolean] true if the scope is paged.

# File lib/shamu/entities/list_scope/paging.rb, line 44
def paged?
  !!page || !!per_page
end