Class: Katalyst::Tables::PagyNavComponent
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- Katalyst::Tables::PagyNavComponent
- Defined in:
- app/components/katalyst/tables/pagy_nav_component.rb
Overview
:nodoc:
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(collection: nil, pagy: nil, **pagy_options) ⇒ PagyNavComponent
constructor
A new instance of PagyNavComponent.
- #inspect ⇒ Object
- #pagy_options ⇒ Object
Constructor Details
#initialize(collection: nil, pagy: nil, **pagy_options) ⇒ PagyNavComponent
Returns a new instance of PagyNavComponent.
16 17 18 19 20 21 22 23 24 25 |
# File 'app/components/katalyst/tables/pagy_nav_component.rb', line 16 def initialize(collection: nil, pagy: nil, **) super() pagy ||= collection&.pagination if collection.respond_to?(:pagination) raise ArgumentError, "pagy is required" if pagy.blank? @pagy = pagy @pagy_options = end |
Class Method Details
.pagy_legacy? ⇒ Boolean
10 11 12 |
# File 'app/components/katalyst/tables/pagy_nav_component.rb', line 10 def self.pagy_legacy? Pagy::VERSION.scan(/\d+/).first.to_i <= 8 end |
Instance Method Details
#call ⇒ Object
27 28 29 |
# File 'app/components/katalyst/tables/pagy_nav_component.rb', line 27 def call pagy_nav(@pagy, **).html_safe # rubocop:disable Rails/OutputSafety end |
#inspect ⇒ Object
35 36 37 |
# File 'app/components/katalyst/tables/pagy_nav_component.rb', line 35 def inspect "#<#{self.class.name} pagy: #{@pagy.inspect}>" end |
#pagy_options ⇒ Object
31 32 33 |
# File 'app/components/katalyst/tables/pagy_nav_component.rb', line 31 def .merge(@pagy_options) end |