Module: Shamu::Entities::ListScope::Dates

Defined in:
lib/shamu/entities/list_scope/dates.rb

Overview

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

Attributes collapse

Instance Method Summary collapse

Instance Attribute Details

#default_sinceTime

Returns default #since if not specified.

Returns:

  • (Time)

    default #since if not specified.



# File 'lib/shamu/entities/list_scope/dates.rb', line 29

#default_untilTime

Returns default #until if not specified.

Returns:

  • (Time)

    default #until if not specified.



# File 'lib/shamu/entities/list_scope/dates.rb', line 32

#sinceTime

Returns include only records added since the given timestamp.

Returns:

  • (Time)

    include only records added since the given timestamp.



# File 'lib/shamu/entities/list_scope/dates.rb', line 23

#untilTime

Returns include only records up until the given timestamp.

Returns:

  • (Time)

    include only records up until the given timestamp.



# File 'lib/shamu/entities/list_scope/dates.rb', line 26

Instance Method Details

#dated?Boolean

Returns true if the scope is dated.

Returns:

  • (Boolean)

    true if the scope is dated.



50
51
52
# File 'lib/shamu/entities/list_scope/dates.rb', line 50

def dated?
  !!self.since || !!self.until # rubocop:disable Style/RedundantSelf
end