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.
24 25 26 27 28 29 30 31 32 33 |
# File 'app/components/katalyst/tables/pagy_nav_component.rb', line 24 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_major < 43 end |
.pagy_major ⇒ Object
18 19 20 |
# File 'app/components/katalyst/tables/pagy_nav_component.rb', line 18 def self.pagy_major @pagy_major ||= Pagy::VERSION.scan(/\d+/).first.to_i end |
.pagy_pre_8? ⇒ Boolean
14 15 16 |
# File 'app/components/katalyst/tables/pagy_nav_component.rb', line 14 def self.pagy_pre_8? pagy_major < 8 end |
Instance Method Details
#call ⇒ Object
35 36 37 |
# File 'app/components/katalyst/tables/pagy_nav_component.rb', line 35 def call render_nav.html_safe # rubocop:disable Rails/OutputSafety end |
#inspect ⇒ Object
43 44 45 |
# File 'app/components/katalyst/tables/pagy_nav_component.rb', line 43 def inspect "#<#{self.class.name} pagy: #{@pagy.inspect}>" end |
#pagy_options ⇒ Object
39 40 41 |
# File 'app/components/katalyst/tables/pagy_nav_component.rb', line 39 def .merge(@pagy_options) end |