Class: Getto::Params::Search::Page

Inherits:
Object
  • Object
show all
Defined in:
lib/getto/params/search.rb

Instance Method Summary collapse

Constructor Details

#initialize(page:, limit:) ⇒ Page

Returns a new instance of Page.



33
34
35
36
# File 'lib/getto/params/search.rb', line 33

def initialize(page:, limit:)
  @page  = page
  @limit = limit
end

Instance Method Details

#to_hObject



38
39
40
41
42
43
# File 'lib/getto/params/search.rb', line 38

def to_h
  {
    limit: @limit,
    offset: (@page.to_i - 1) * @limit,
  }
end