Options Hierarchy


Pagy implements a hierarchical options system working at three different levels, regardless of where the option gets consumed.

Levels

  • For example, Pagy::OPTIONS[:limit] = 10 set in the pagy.rb initializer.
  • The Pagy::OPTIONS are inherited by all paginators and helpers.
  • Good practice: Call Pagy::OPTIONS.freeze after you set your Pagy::OPTIONS.
  • For example, pagy(paginator, collection, **options).
  • The options passed to a paginator override the Pagy::OPTIONS for that instance.
  • They are also inherited by all the helpers used by the instance.
  • For example, @pagy.series_nav(**options).
  • The options passed to a helper override the options affecting its output.
  • The options consumed upstream are not affected.