Class: Uchi::Ui::Pagination::Item

Inherits:
ViewComponent::Base
  • Object
show all
Defined in:
app/components/uchi/ui/pagination/item.rb

Direct Known Subclasses

CurrentLink, Gap, Link, NextLink, PreviousLink

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(paginator:, page_number: nil) ⇒ Item

Returns a new instance of Item.

Parameters:



10
11
12
13
14
# File 'app/components/uchi/ui/pagination/item.rb', line 10

def initialize(paginator:, page_number: nil)
  super()
  @page_number = page_number
  @paginator = paginator
end

Instance Attribute Details

#page_numberObject (readonly)

Returns the value of attribute page_number.



7
8
9
# File 'app/components/uchi/ui/pagination/item.rb', line 7

def page_number
  @page_number
end

#paginatorObject (readonly)

Returns the value of attribute paginator.



7
8
9
# File 'app/components/uchi/ui/pagination/item.rb', line 7

def paginator
  @paginator
end

Instance Method Details

#page_url(page) ⇒ Object

Returns the URL for a given page. page can be a number, of :first, :last, :previous, :next, :current.



18
19
20
# File 'app/components/uchi/ui/pagination/item.rb', line 18

def page_url(page)
  paginator.page_url(page)
end