module Shamu::Entities::ListScope::Dates
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/dates.rb, line 38 def self.included( base ) super coerce = Time.instance_method( :to_time ) ? :to_time : nil base.attribute :since, coerce: coerce, default: ->() { default_since } base.attribute :default_since, coerce: coerce, serialize: false base.attribute :until, coerce: coerce, default: ->() { default_until } base.attribute :default_until, coerce: coerce, serialize: false end
Public Instance Methods
dated?()
click to toggle source
@return [Boolean] true if the scope is dated.
# File lib/shamu/entities/list_scope/dates.rb, line 50 def dated? !!self.since || !!self.until # rubocop:disable Style/RedundantSelf end