Class: PhlexKit::DataTablePagyAdapter
- Inherits:
-
Object
- Object
- PhlexKit::DataTablePagyAdapter
- Defined in:
- app/components/phlex_kit/data_table/data_table_pagy_adapter.rb
Overview
Adapter exposing a Pagy object to PhlexKit::DataTablePagination (the gem is the host's dependency, not ours). Ported from ruby_ui.
Instance Method Summary collapse
- #current_page ⇒ Object
-
#initialize(pagy) ⇒ DataTablePagyAdapter
constructor
A new instance of DataTablePagyAdapter.
-
#per_page ⇒ Object
Pagy 9 renamed #items to #limit (and removed #items) — support both.
- #total_count ⇒ Object
- #total_pages ⇒ Object
Constructor Details
#initialize(pagy) ⇒ DataTablePagyAdapter
Returns a new instance of DataTablePagyAdapter.
5 6 7 |
# File 'app/components/phlex_kit/data_table/data_table_pagy_adapter.rb', line 5 def initialize(pagy) @pagy = pagy end |
Instance Method Details
#current_page ⇒ Object
9 |
# File 'app/components/phlex_kit/data_table/data_table_pagy_adapter.rb', line 9 def current_page = @pagy.page |
#per_page ⇒ Object
Pagy 9 renamed #items to #limit (and removed #items) — support both.
16 |
# File 'app/components/phlex_kit/data_table/data_table_pagy_adapter.rb', line 16 def per_page = @pagy.respond_to?(:limit) ? @pagy.limit : @pagy.items |
#total_count ⇒ Object
13 |
# File 'app/components/phlex_kit/data_table/data_table_pagy_adapter.rb', line 13 def total_count = @pagy.count |
#total_pages ⇒ Object
11 |
# File 'app/components/phlex_kit/data_table/data_table_pagy_adapter.rb', line 11 def total_pages = @pagy.pages |