module Shamu::Entities::ListScope::ScopedPaging
Include paging parsing and attributes exposed as a nested page object. Adds the following attributes to the list scope:
“` class UsersListScope < Shamu::Entities::ListScope
include Shamu::Entities::ListScope::ScopedPaging
end
scope = UsersListScope.coerce!( page: { number: 5, size: 50 } ) scope.page.number # => 5 scope.page.size # => 50 “`
Public Class Methods
included( base )
click to toggle source
@!endgroup Attributes
Calls superclass method
# File lib/shamu/entities/list_scope/scoped_paging.rb, line 29 def self.included( base ) super base.attribute :page, build: PageScope, default: PageScope.new end
Public Instance Methods
scoped_page?()
click to toggle source
@return [Boolean] true if the scope is paged.
# File lib/shamu/entities/list_scope/scoped_paging.rb, line 36 def scoped_page? !!page.number end