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.



37
38
39
40
# File 'lib/getto/params/search.rb', line 37

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

Instance Method Details

#to_hObject



42
43
44
45
46
47
# File 'lib/getto/params/search.rb', line 42

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