class

Term2::Components::Paginator

Inherits Term2::Model < Reference < Object

Constructors

new

Default constructor

Source
new(*, per_page : Int32 = 1, total_pages : Int32 = 1, page : Int32 = 0)

[FIX] Constructor with named arguments for testing/convenience

Source

Instance methods

active_dot

Styles for Dots

Source
active_dot=(active_dot : String)

Styles for Dots

Source
arabic_format

Styles for Arabic

Source
arabic_format=(arabic_format : String)

Styles for Arabic

Source
get_slice_bounds(total_items : Int32) : Tuple(Int32, Int32)

Calculate the slice bounds for the current page Returns {start, end} indices for slicing an array

Source
inactive_dot
Source
inactive_dot=(inactive_dot : String)
Source
init

Init is the first function that will be called. It returns an optional initial command. To not perform an initial command return nil.

Source
items_on_page(total_items : Int32) : Int32

Returns the number of items on the current page

Source
next_page
Source
on_first_page?
Source
on_last_page?
Source
page
Source
page=(page : Int32)
Source
per_page
Source
per_page=(per_page : Int32)
Source
prev_page
Source
set_total_pages(items_count : Int32)

Set total pages based on items count and items per page

Source
total_pages
Source
total_pages=(val : Int32)
Source
type
Source
type=(type : Type)
Source
update(msg : Msg) : Tuple(Paginator, Cmd)

Update is called when a message is received. Use it to inspect the message and, in response, update the model and/or send a command.

Source
view

View renders the program's UI, which is just a string. The view is rendered after every Update.

Source

Nested types