repo
stringlengths
5
92
file_url
stringlengths
80
287
file_path
stringlengths
5
197
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-04 15:37:27
2026-01-04 17:58:21
truncated
bool
2 classes
ddnexus/pagy
https://github.com/ddnexus/pagy/blob/fe1f35863e3bad60ef8731e298c7cb38af4e7af6/test/pagy/classes/offset/countish_test.rb
test/pagy/classes/offset/countish_test.rb
# frozen_string_literal: true require 'test_helper' describe Pagy::Offset::Countish do let(:pagy_class) { Pagy::Offset::Countish } it 'composes page param with count' do pagy = pagy_class.new(count: 100) param = pagy.send(:compose_page_param, 2) _(param).must_be_kind_of Pagy::EscapedValue _(para...
ruby
MIT
fe1f35863e3bad60ef8731e298c7cb38af4e7af6
2026-01-04T15:44:39.884044Z
false
ddnexus/pagy
https://github.com/ddnexus/pagy/blob/fe1f35863e3bad60ef8731e298c7cb38af4e7af6/test/pagy/classes/offset/countless_test.rb
test/pagy/classes/offset/countless_test.rb
# frozen_string_literal: true require 'test_helper' describe Pagy::Offset::Countless do let(:pagy_class) { Pagy::Offset::Countless } describe 'initialization' do it 'initializes with defaults' do pagy = pagy_class.new _(pagy.page).must_equal 1 _(pagy.limit).must_equal 20 _(pagy.offset...
ruby
MIT
fe1f35863e3bad60ef8731e298c7cb38af4e7af6
2026-01-04T15:44:39.884044Z
false
ddnexus/pagy
https://github.com/ddnexus/pagy/blob/fe1f35863e3bad60ef8731e298c7cb38af4e7af6/test/pagy/classes/calendar/calendar_test.rb
test/pagy/classes/calendar/calendar_test.rb
# frozen_string_literal: true require 'test_helper' require 'pagy/classes/calendar/calendar' require 'mocks/app' describe Pagy::Calendar do let(:period) { [Time.zone.local(2021, 10, 21), Time.zone.local(2023, 11, 13)] } # Configuration mimicking what CalendarPaginator passes let(:conf) do # Ensure marshalab...
ruby
MIT
fe1f35863e3bad60ef8731e298c7cb38af4e7af6
2026-01-04T15:44:39.884044Z
false
ddnexus/pagy
https://github.com/ddnexus/pagy/blob/fe1f35863e3bad60ef8731e298c7cb38af4e7af6/test/pagy/classes/calendar/unit_test.rb
test/pagy/classes/calendar/unit_test.rb
# frozen_string_literal: true require 'test_helper' require 'pagy/classes/calendar/calendar' describe Pagy::Calendar::Unit do # Use a concrete subclass (Year) to test inherited behavior let(:unit_class) { Pagy::Calendar::Year } let(:period) { [Time.zone.local(2021, 10, 21), Time.zone.local(2023, 11, 13)] } le...
ruby
MIT
fe1f35863e3bad60ef8731e298c7cb38af4e7af6
2026-01-04T15:44:39.884044Z
false
ddnexus/pagy
https://github.com/ddnexus/pagy/blob/fe1f35863e3bad60ef8731e298c7cb38af4e7af6/test/pagy/classes/calendar/year_test.rb
test/pagy/classes/calendar/year_test.rb
# frozen_string_literal: true require 'test_helper' require 'pagy/classes/calendar/calendar' describe Pagy::Calendar::Year do let(:period) { [Time.zone.local(2021, 10, 21, 13, 18, 23, 0), Time.zone.local(2023, 11, 13, 15, 43, 40, 0)] } let(:default_opts) { { period: period } } before do Time.zone = 'Etc/GM...
ruby
MIT
fe1f35863e3bad60ef8731e298c7cb38af4e7af6
2026-01-04T15:44:39.884044Z
false
ddnexus/pagy
https://github.com/ddnexus/pagy/blob/fe1f35863e3bad60ef8731e298c7cb38af4e7af6/test/pagy/classes/calendar/quarter_test.rb
test/pagy/classes/calendar/quarter_test.rb
# frozen_string_literal: true require 'test_helper' require 'pagy/classes/calendar/calendar' describe Pagy::Calendar::Quarter do let(:period) { [Time.zone.local(2021, 10, 21, 13, 18, 23, 0), Time.zone.local(2023, 11, 13, 15, 43, 40, 0)] } let(:default_opts) { { period: period } } before do Time.zone = 'Etc...
ruby
MIT
fe1f35863e3bad60ef8731e298c7cb38af4e7af6
2026-01-04T15:44:39.884044Z
false
ddnexus/pagy
https://github.com/ddnexus/pagy/blob/fe1f35863e3bad60ef8731e298c7cb38af4e7af6/test/pagy/classes/calendar/month_test.rb
test/pagy/classes/calendar/month_test.rb
# frozen_string_literal: true require 'test_helper' require 'pagy/classes/calendar/calendar' describe Pagy::Calendar::Month do let(:period) { [Time.zone.local(2021, 10, 21, 13, 18, 23, 0), Time.zone.local(2023, 11, 13, 15, 43, 40, 0)] } let(:default_opts) { { period: period } } before do Time.zone = 'Etc/G...
ruby
MIT
fe1f35863e3bad60ef8731e298c7cb38af4e7af6
2026-01-04T15:44:39.884044Z
false
ddnexus/pagy
https://github.com/ddnexus/pagy/blob/fe1f35863e3bad60ef8731e298c7cb38af4e7af6/test/pagy/classes/calendar/day_test.rb
test/pagy/classes/calendar/day_test.rb
# frozen_string_literal: true require 'test_helper' require 'pagy/classes/calendar/calendar' describe Pagy::Calendar::Day do let(:period) { [Time.zone.local(2021, 10, 21, 13, 18, 23, 0), Time.zone.local(2023, 11, 13, 15, 43, 40, 0)] } let(:default_opts) { { period: period } } before do Time.zone = 'Etc/GMT...
ruby
MIT
fe1f35863e3bad60ef8731e298c7cb38af4e7af6
2026-01-04T15:44:39.884044Z
false
ddnexus/pagy
https://github.com/ddnexus/pagy/blob/fe1f35863e3bad60ef8731e298c7cb38af4e7af6/test/pagy/classes/calendar/week_test.rb
test/pagy/classes/calendar/week_test.rb
# frozen_string_literal: true require 'test_helper' require 'pagy/classes/calendar/calendar' describe Pagy::Calendar::Week do let(:period) { [Time.zone.local(2021, 10, 21, 13, 18, 23, 0), Time.zone.local(2023, 11, 13, 15, 43, 40, 0)] } let(:default_opts) { { period: period } } before do Time.zone = 'Etc/GM...
ruby
MIT
fe1f35863e3bad60ef8731e298c7cb38af4e7af6
2026-01-04T15:44:39.884044Z
false
ddnexus/pagy
https://github.com/ddnexus/pagy/blob/fe1f35863e3bad60ef8731e298c7cb38af4e7af6/gem/apps/index.rb
gem/apps/index.rb
# frozen_string_literal: true # PagyApp module module PagyApps # Return the hash of app name/path INDEX = Dir[File.expand_path('./*.ru', __dir__)].to_h do |f| [File.basename(f, '.ru'), f] end.freeze end
ruby
MIT
fe1f35863e3bad60ef8731e298c7cb38af4e7af6
2026-01-04T15:44:39.884044Z
false
ddnexus/pagy
https://github.com/ddnexus/pagy/blob/fe1f35863e3bad60ef8731e298c7cb38af4e7af6/gem/apps/enable_rails_page_segment.rb
gem/apps/enable_rails_page_segment.rb
# frozen_string_literal: true # ################# IMPORTANT WARNING ################# # This setup forces Pagy to use the Rails `url_for` method, # which is significantly slower (~20x) than Pagy's native URL generation. # Use this file ONLY if you absolutely want to support the page param as a dynamic segment. # (e.g...
ruby
MIT
fe1f35863e3bad60ef8731e298c7cb38af4e7af6
2026-01-04T15:44:39.884044Z
false
ddnexus/pagy
https://github.com/ddnexus/pagy/blob/fe1f35863e3bad60ef8731e298c7cb38af4e7af6/gem/lib/pagy.rb
gem/lib/pagy.rb
# frozen_string_literal: true require 'pathname' require_relative 'pagy/classes/exceptions' require_relative 'pagy/modules/abilities/linkable' require_relative 'pagy/modules/abilities/configurable' require_relative 'pagy/toolbox/helpers/loader' # Top superclass: it defines only what's common to all the subclasses cla...
ruby
MIT
fe1f35863e3bad60ef8731e298c7cb38af4e7af6
2026-01-04T15:44:39.884044Z
false
ddnexus/pagy
https://github.com/ddnexus/pagy/blob/fe1f35863e3bad60ef8731e298c7cb38af4e7af6/gem/lib/pagy/console.rb
gem/lib/pagy/console.rb
# frozen_string_literal: true # Console loader require 'pagy' include Pagy::Console # rubocop:disable Style/MixinUsage
ruby
MIT
fe1f35863e3bad60ef8731e298c7cb38af4e7af6
2026-01-04T15:44:39.884044Z
false
ddnexus/pagy
https://github.com/ddnexus/pagy/blob/fe1f35863e3bad60ef8731e298c7cb38af4e7af6/gem/lib/pagy/cli.rb
gem/lib/pagy/cli.rb
# frozen_string_literal: true require 'optparse' require 'fileutils' require 'rbconfig' require 'pagy' require_relative '../../apps/index' class Pagy class CLI LINUX = RbConfig::CONFIG['host_os'].include?('linux') HOST = 'localhost' PORT = '8000' def start(args = ARGV) options = parse_optio...
ruby
MIT
fe1f35863e3bad60ef8731e298c7cb38af4e7af6
2026-01-04T15:44:39.884044Z
false
ddnexus/pagy
https://github.com/ddnexus/pagy/blob/fe1f35863e3bad60ef8731e298c7cb38af4e7af6/gem/lib/pagy/modules/console.rb
gem/lib/pagy/modules/console.rb
# frozen_string_literal: true class Pagy # Provide a ready to use pagy environment when included in irb/rails console module Console class Collection < Array def initialize(arr = Array(1..1000)) super @collection = clone end def offset(value) = tap { @collection = self[value....
ruby
MIT
fe1f35863e3bad60ef8731e298c7cb38af4e7af6
2026-01-04T15:44:39.884044Z
false
ddnexus/pagy
https://github.com/ddnexus/pagy/blob/fe1f35863e3bad60ef8731e298c7cb38af4e7af6/gem/lib/pagy/modules/b64.rb
gem/lib/pagy/modules/b64.rb
# frozen_string_literal: true class Pagy # Cheap Base64 specialized methods to avoid dependencies module B64 module_function def encode(bin) = [bin].pack('m0') def decode(str) = str.unpack1('m0') def urlsafe_encode(bin) str = encode(bin) str.chomp!('==') or str.chomp!('=') str....
ruby
MIT
fe1f35863e3bad60ef8731e298c7cb38af4e7af6
2026-01-04T15:44:39.884044Z
false
ddnexus/pagy
https://github.com/ddnexus/pagy/blob/fe1f35863e3bad60ef8731e298c7cb38af4e7af6/gem/lib/pagy/modules/searcher.rb
gem/lib/pagy/modules/searcher.rb
# frozen_string_literal: true class Pagy # Relegate internal functions. Make overriding search classes easier. module Searcher module_function # Common search logic def wrap(pagy_search_args, options) options[:page] ||= options[:request].resolve_page options[:limit] = options[:request].re...
ruby
MIT
fe1f35863e3bad60ef8731e298c7cb38af4e7af6
2026-01-04T15:44:39.884044Z
false
ddnexus/pagy
https://github.com/ddnexus/pagy/blob/fe1f35863e3bad60ef8731e298c7cb38af4e7af6/gem/lib/pagy/modules/abilities/rangeable.rb
gem/lib/pagy/modules/abilities/rangeable.rb
# frozen_string_literal: true class Pagy # Add method supporting range checking, range error and rescue module Rangeable # Check if in range def in_range? return @in_range if defined?(@in_range) return true if (@in_range = yield) raise RangeError.new(self, :page, "in 1..#{@last}", @page) ...
ruby
MIT
fe1f35863e3bad60ef8731e298c7cb38af4e7af6
2026-01-04T15:44:39.884044Z
false
ddnexus/pagy
https://github.com/ddnexus/pagy/blob/fe1f35863e3bad60ef8731e298c7cb38af4e7af6/gem/lib/pagy/modules/abilities/shiftable.rb
gem/lib/pagy/modules/abilities/shiftable.rb
# frozen_string_literal: true class Pagy module Shiftable protected def assign_previous_and_next @previous = @page - 1 unless @page == 1 @next = @page + 1 unless @page == @last end end end
ruby
MIT
fe1f35863e3bad60ef8731e298c7cb38af4e7af6
2026-01-04T15:44:39.884044Z
false
ddnexus/pagy
https://github.com/ddnexus/pagy/blob/fe1f35863e3bad60ef8731e298c7cb38af4e7af6/gem/lib/pagy/modules/abilities/countable.rb
gem/lib/pagy/modules/abilities/countable.rb
# frozen_string_literal: true class Pagy # Provide the helpers to count a collection module Countable module_function # Get the collection count def get_count(collection, options) return collection.size if collection.instance_of?(Array) return collection.count unless defined?(::ActiveRecor...
ruby
MIT
fe1f35863e3bad60ef8731e298c7cb38af4e7af6
2026-01-04T15:44:39.884044Z
false
ddnexus/pagy
https://github.com/ddnexus/pagy/blob/fe1f35863e3bad60ef8731e298c7cb38af4e7af6/gem/lib/pagy/modules/abilities/linkable.rb
gem/lib/pagy/modules/abilities/linkable.rb
# frozen_string_literal: true require 'uri' class Pagy # Support spaces in placeholder params class EscapedValue < String; end # Provide the helpers to handle the url and anchor module Linkable module QueryUtils module_function # Extracted from Rack::Utils and reformatted for rubocop #...
ruby
MIT
fe1f35863e3bad60ef8731e298c7cb38af4e7af6
2026-01-04T15:44:39.884044Z
false
ddnexus/pagy
https://github.com/ddnexus/pagy/blob/fe1f35863e3bad60ef8731e298c7cb38af4e7af6/gem/lib/pagy/modules/abilities/configurable.rb
gem/lib/pagy/modules/abilities/configurable.rb
# frozen_string_literal: true class Pagy # Add configurstion methods module Configurable # Sync the pagy javascript targets def sync_javascript(destination, *targets) names = %w[pagy.mjs pagy.js pagy.js.map pagy.min.js] targets = names if targets.empty? targets.each { |filename| FileUti...
ruby
MIT
fe1f35863e3bad60ef8731e298c7cb38af4e7af6
2026-01-04T15:44:39.884044Z
false
ddnexus/pagy
https://github.com/ddnexus/pagy/blob/fe1f35863e3bad60ef8731e298c7cb38af4e7af6/gem/lib/pagy/modules/i18n/p11n.rb
gem/lib/pagy/modules/i18n/p11n.rb
# frozen_string_literal: true class Pagy module I18n module P11n path = ROOT.join('lib/pagy/modules/i18n/p11n') autoload :Arabic, path.join('arabic') autoload :EastSlavic, path.join('east_slavic') autoload :OneOther, path.join('one_other') autoload :OneUptoTwoOt...
ruby
MIT
fe1f35863e3bad60ef8731e298c7cb38af4e7af6
2026-01-04T15:44:39.884044Z
false
ddnexus/pagy
https://github.com/ddnexus/pagy/blob/fe1f35863e3bad60ef8731e298c7cb38af4e7af6/gem/lib/pagy/modules/i18n/i18n.rb
gem/lib/pagy/modules/i18n/i18n.rb
# frozen_string_literal: true require 'yaml' require_relative 'p11n' class Pagy # Pagy i18n implementation, compatible with the I18n gem, just a lot faster and lighter module I18n extend self def pathnames = @pathnames ||= [ROOT.join('locales')] def locales = @locales ||= {} # Store the vari...
ruby
MIT
fe1f35863e3bad60ef8731e298c7cb38af4e7af6
2026-01-04T15:44:39.884044Z
false
ddnexus/pagy
https://github.com/ddnexus/pagy/blob/fe1f35863e3bad60ef8731e298c7cb38af4e7af6/gem/lib/pagy/modules/i18n/p11n/east_slavic.rb
gem/lib/pagy/modules/i18n/p11n/east_slavic.rb
# frozen_string_literal: true class Pagy module I18n module P11n module EastSlavic module_function def plural_for(n = 0) mod10 = n % 10 mod100 = n % 100 case when mod10 == 1 && mod100 != 11 :one when (2..4).to_a.include?(mod10)...
ruby
MIT
fe1f35863e3bad60ef8731e298c7cb38af4e7af6
2026-01-04T15:44:39.884044Z
false
ddnexus/pagy
https://github.com/ddnexus/pagy/blob/fe1f35863e3bad60ef8731e298c7cb38af4e7af6/gem/lib/pagy/modules/i18n/p11n/other.rb
gem/lib/pagy/modules/i18n/p11n/other.rb
# frozen_string_literal: true class Pagy module I18n module P11n module Other module_function def plural_for(*) = :other end end end end
ruby
MIT
fe1f35863e3bad60ef8731e298c7cb38af4e7af6
2026-01-04T15:44:39.884044Z
false
ddnexus/pagy
https://github.com/ddnexus/pagy/blob/fe1f35863e3bad60ef8731e298c7cb38af4e7af6/gem/lib/pagy/modules/i18n/p11n/one_upto_two_other.rb
gem/lib/pagy/modules/i18n/p11n/one_upto_two_other.rb
# frozen_string_literal: true class Pagy module I18n module P11n module OneUptoTwoOther module_function def plural_for(n = 0) n >= 0 && n < 2 ? :one : :other end end end end end
ruby
MIT
fe1f35863e3bad60ef8731e298c7cb38af4e7af6
2026-01-04T15:44:39.884044Z
false
ddnexus/pagy
https://github.com/ddnexus/pagy/blob/fe1f35863e3bad60ef8731e298c7cb38af4e7af6/gem/lib/pagy/modules/i18n/p11n/one_other.rb
gem/lib/pagy/modules/i18n/p11n/one_other.rb
# frozen_string_literal: true class Pagy module I18n module P11n module OneOther module_function def plural_for(n = 0) n == 1 ? :one : :other end end end end end
ruby
MIT
fe1f35863e3bad60ef8731e298c7cb38af4e7af6
2026-01-04T15:44:39.884044Z
false
ddnexus/pagy
https://github.com/ddnexus/pagy/blob/fe1f35863e3bad60ef8731e298c7cb38af4e7af6/gem/lib/pagy/modules/i18n/p11n/west_slavic.rb
gem/lib/pagy/modules/i18n/p11n/west_slavic.rb
# frozen_string_literal: true class Pagy module I18n module P11n module WestSlavic module_function def plural_for(n = 0) case n when 1 :one when 2, 3, 4 :few else :other end end end end ...
ruby
MIT
fe1f35863e3bad60ef8731e298c7cb38af4e7af6
2026-01-04T15:44:39.884044Z
false
ddnexus/pagy
https://github.com/ddnexus/pagy/blob/fe1f35863e3bad60ef8731e298c7cb38af4e7af6/gem/lib/pagy/modules/i18n/p11n/arabic.rb
gem/lib/pagy/modules/i18n/p11n/arabic.rb
# frozen_string_literal: true class Pagy module I18n module P11n module Arabic module_function def plural_for(n = 0) mod100 = n % 100 case when n == 0 # rubocop:disable Style/NumericPredicate :zero when n == 1 :one ...
ruby
MIT
fe1f35863e3bad60ef8731e298c7cb38af4e7af6
2026-01-04T15:44:39.884044Z
false
ddnexus/pagy
https://github.com/ddnexus/pagy/blob/fe1f35863e3bad60ef8731e298c7cb38af4e7af6/gem/lib/pagy/modules/i18n/p11n/polish.rb
gem/lib/pagy/modules/i18n/p11n/polish.rb
# frozen_string_literal: true class Pagy module I18n module P11n module Polish module_function def plural_for(n = 0) mod10 = n % 10 mod100 = n % 100 case when n == 1 :one when [2, 3, 4].include?(mod10) && ![12, 13, 14].include?...
ruby
MIT
fe1f35863e3bad60ef8731e298c7cb38af4e7af6
2026-01-04T15:44:39.884044Z
false
ddnexus/pagy
https://github.com/ddnexus/pagy/blob/fe1f35863e3bad60ef8731e298c7cb38af4e7af6/gem/lib/pagy/toolbox/helpers/data_hash.rb
gem/lib/pagy/toolbox/helpers/data_hash.rb
# frozen_string_literal: true class Pagy DEFAULT_DATA_KEYS = %i[url_template first_url previous_url current_url page_url next_url last_url count page limit last in from to previous next options].freeze # Generate a hash of the wanted internal data def data_hash(data_keys: @options[:data...
ruby
MIT
fe1f35863e3bad60ef8731e298c7cb38af4e7af6
2026-01-04T15:44:39.884044Z
false
ddnexus/pagy
https://github.com/ddnexus/pagy/blob/fe1f35863e3bad60ef8731e298c7cb38af4e7af6/gem/lib/pagy/toolbox/helpers/limit_tag_js.rb
gem/lib/pagy/toolbox/helpers/limit_tag_js.rb
# frozen_string_literal: true require_relative 'support/data_pagy_attribute' class Pagy # Return the limit selector HTML. For example "Show [20] items per page" def limit_tag_js(id: nil, item_name: nil, client_max_limit: @options[:client_max_limit], **) raise OptionError.new(self, :client_max_limit, 'to be tr...
ruby
MIT
fe1f35863e3bad60ef8731e298c7cb38af4e7af6
2026-01-04T15:44:39.884044Z
false
ddnexus/pagy
https://github.com/ddnexus/pagy/blob/fe1f35863e3bad60ef8731e298c7cb38af4e7af6/gem/lib/pagy/toolbox/helpers/info_tag.rb
gem/lib/pagy/toolbox/helpers/info_tag.rb
# frozen_string_literal: true class Pagy # Instances with count return "Displaying items 41-60 of 324 in total" or "Displaying Products 41-60 of 324 in total" # Instances with no count return only page info: "Page 3 of 100" def info_tag(id: nil, item_name: nil) i18n_key = if @count.nil? 'p...
ruby
MIT
fe1f35863e3bad60ef8731e298c7cb38af4e7af6
2026-01-04T15:44:39.884044Z
false
ddnexus/pagy
https://github.com/ddnexus/pagy/blob/fe1f35863e3bad60ef8731e298c7cb38af4e7af6/gem/lib/pagy/toolbox/helpers/loader.rb
gem/lib/pagy/toolbox/helpers/loader.rb
# frozen_string_literal: true class Pagy module Loader paths = { public: { page_url: 'page_url', data_hash: 'data_hash', headers_hash: 'headers_hash', urls_hash: 'urls_hash', ...
ruby
MIT
fe1f35863e3bad60ef8731e298c7cb38af4e7af6
2026-01-04T15:44:39.884044Z
false
ddnexus/pagy
https://github.com/ddnexus/pagy/blob/fe1f35863e3bad60ef8731e298c7cb38af4e7af6/gem/lib/pagy/toolbox/helpers/headers_hash.rb
gem/lib/pagy/toolbox/helpers/headers_hash.rb
# frozen_string_literal: true require_relative 'urls_hash' # Add pagination response headers class Pagy DEFAULT_HEADERS_MAP = { page: 'current-page', limit: 'page-limit', count: 'total-count', pages: 'total-pages' }.freeze # Generate a...
ruby
MIT
fe1f35863e3bad60ef8731e298c7cb38af4e7af6
2026-01-04T15:44:39.884044Z
false
ddnexus/pagy
https://github.com/ddnexus/pagy/blob/fe1f35863e3bad60ef8731e298c7cb38af4e7af6/gem/lib/pagy/toolbox/helpers/input_nav_js.rb
gem/lib/pagy/toolbox/helpers/input_nav_js.rb
# frozen_string_literal: true require_relative 'support/wrap_input_nav_js' class Pagy # JavaScript input pagination: it returns a nav with a data-pagy attribute used by the pagy.js file def input_nav_js(style = nil, **) return send(:"#{style}_input_nav_js", **) if style a_lambda = a_lambda(**) input ...
ruby
MIT
fe1f35863e3bad60ef8731e298c7cb38af4e7af6
2026-01-04T15:44:39.884044Z
false
ddnexus/pagy
https://github.com/ddnexus/pagy/blob/fe1f35863e3bad60ef8731e298c7cb38af4e7af6/gem/lib/pagy/toolbox/helpers/page_url.rb
gem/lib/pagy/toolbox/helpers/page_url.rb
# frozen_string_literal: true class Pagy # Return the page url for any page def page_url(page, **) target = case page when :first then nil when :current, :page then @page when :previous then @previous when :next then @next ...
ruby
MIT
fe1f35863e3bad60ef8731e298c7cb38af4e7af6
2026-01-04T15:44:39.884044Z
false
ddnexus/pagy
https://github.com/ddnexus/pagy/blob/fe1f35863e3bad60ef8731e298c7cb38af4e7af6/gem/lib/pagy/toolbox/helpers/series_nav.rb
gem/lib/pagy/toolbox/helpers/series_nav.rb
# frozen_string_literal: true require_relative 'support/wrap_series_nav' class Pagy # Return the HTML with the series of links to the pages def series_nav(style = nil, **) return send(:"#{style}_series_nav", **) if style a_lambda = a_lambda(**) html = previous_tag(a_lambda) series(**).each do...
ruby
MIT
fe1f35863e3bad60ef8731e298c7cb38af4e7af6
2026-01-04T15:44:39.884044Z
false
ddnexus/pagy
https://github.com/ddnexus/pagy/blob/fe1f35863e3bad60ef8731e298c7cb38af4e7af6/gem/lib/pagy/toolbox/helpers/anchor_tags.rb
gem/lib/pagy/toolbox/helpers/anchor_tags.rb
# frozen_string_literal: true require_relative 'support/a_lambda' # inheritable class Pagy # Return the enabled/disabled previous page anchor tag def previous_tag(a = nil, text: I18n.translate('pagy.previous'), aria_label: I18n.translate('pagy.aria_label.previous'), **) if @previous (...
ruby
MIT
fe1f35863e3bad60ef8731e298c7cb38af4e7af6
2026-01-04T15:44:39.884044Z
false
ddnexus/pagy
https://github.com/ddnexus/pagy/blob/fe1f35863e3bad60ef8731e298c7cb38af4e7af6/gem/lib/pagy/toolbox/helpers/series_nav_js.rb
gem/lib/pagy/toolbox/helpers/series_nav_js.rb
# frozen_string_literal: true require_relative 'support/wrap_series_nav_js' class Pagy # Return a nav with a data-pagy attribute used by the pagy.js file def series_nav_js(style = nil, **) return send(:"#{style}_series_nav_js", **) if style a_lambda = a_lambda(**) tokens = { before: previous_tag(a...
ruby
MIT
fe1f35863e3bad60ef8731e298c7cb38af4e7af6
2026-01-04T15:44:39.884044Z
false
ddnexus/pagy
https://github.com/ddnexus/pagy/blob/fe1f35863e3bad60ef8731e298c7cb38af4e7af6/gem/lib/pagy/toolbox/helpers/urls_hash.rb
gem/lib/pagy/toolbox/helpers/urls_hash.rb
# frozen_string_literal: true class Pagy # Generate the hash of the pagination links def urls_hash(**) template = compose_page_url(PAGE_TOKEN, **) { first: compose_page_url(nil, **), previous: @previous && template.sub(PAGE_TOKEN, @previous.to_s), next: @next && template.sub(PAGE_TO...
ruby
MIT
fe1f35863e3bad60ef8731e298c7cb38af4e7af6
2026-01-04T15:44:39.884044Z
false
ddnexus/pagy
https://github.com/ddnexus/pagy/blob/fe1f35863e3bad60ef8731e298c7cb38af4e7af6/gem/lib/pagy/toolbox/helpers/support/wrap_series_nav_js.rb
gem/lib/pagy/toolbox/helpers/support/wrap_series_nav_js.rb
# frozen_string_literal: true require_relative 'series' require_relative 'nav_aria_label_attribute' require_relative 'data_pagy_attribute' require_relative 'a_lambda' # inherited use # Relegate internal functions. Make overriding navs easier. class Pagy private # Return the reverse sorted array of widths, series...
ruby
MIT
fe1f35863e3bad60ef8731e298c7cb38af4e7af6
2026-01-04T15:44:39.884044Z
false
ddnexus/pagy
https://github.com/ddnexus/pagy/blob/fe1f35863e3bad60ef8731e298c7cb38af4e7af6/gem/lib/pagy/toolbox/helpers/support/wrap_series_nav.rb
gem/lib/pagy/toolbox/helpers/support/wrap_series_nav.rb
# frozen_string_literal: true require_relative 'series' require_relative 'nav_aria_label_attribute' require_relative 'data_pagy_attribute' require_relative 'a_lambda' # inherited use # Relegate internal functions. Make overriding navs easier. class Pagy private # Build the nav tag, with the specific inner html f...
ruby
MIT
fe1f35863e3bad60ef8731e298c7cb38af4e7af6
2026-01-04T15:44:39.884044Z
false
ddnexus/pagy
https://github.com/ddnexus/pagy/blob/fe1f35863e3bad60ef8731e298c7cb38af4e7af6/gem/lib/pagy/toolbox/helpers/support/wrap_input_nav_js.rb
gem/lib/pagy/toolbox/helpers/support/wrap_input_nav_js.rb
# frozen_string_literal: true require_relative 'nav_aria_label_attribute' require_relative 'data_pagy_attribute' require_relative 'a_lambda' # inherited use # Relegate internal functions. Make overriding navs easier. class Pagy private # Build the input_nav_js tag, with the specific inner html for the style de...
ruby
MIT
fe1f35863e3bad60ef8731e298c7cb38af4e7af6
2026-01-04T15:44:39.884044Z
false
ddnexus/pagy
https://github.com/ddnexus/pagy/blob/fe1f35863e3bad60ef8731e298c7cb38af4e7af6/gem/lib/pagy/toolbox/helpers/support/data_pagy_attribute.rb
gem/lib/pagy/toolbox/helpers/support/data_pagy_attribute.rb
# frozen_string_literal: true require 'json' require_relative '../../../modules/b64' # Relegate internal functions. Make overriding navs easier. class Pagy private # Compose the data-pagy attribute, with the base64 encoded JSON-serialized args. Use the faster oj gem if defined. def data_pagy_attribute(*args) ...
ruby
MIT
fe1f35863e3bad60ef8731e298c7cb38af4e7af6
2026-01-04T15:44:39.884044Z
false
ddnexus/pagy
https://github.com/ddnexus/pagy/blob/fe1f35863e3bad60ef8731e298c7cb38af4e7af6/gem/lib/pagy/toolbox/helpers/support/series.rb
gem/lib/pagy/toolbox/helpers/support/series.rb
# frozen_string_literal: true class Pagy SERIES_SLOTS = 7 protected # Return the array of page numbers and :gap e.g. [1, :gap, 8, "9", 10, :gap, 36] def series(slots: @options[:slots] || SERIES_SLOTS, compact: @options[:compact], **) raise OptionError.new(self, :slots, 'to be an Integer >= 0', slots) \ ...
ruby
MIT
fe1f35863e3bad60ef8731e298c7cb38af4e7af6
2026-01-04T15:44:39.884044Z
false
ddnexus/pagy
https://github.com/ddnexus/pagy/blob/fe1f35863e3bad60ef8731e298c7cb38af4e7af6/gem/lib/pagy/toolbox/helpers/support/nav_aria_label_attribute.rb
gem/lib/pagy/toolbox/helpers/support/nav_aria_label_attribute.rb
# frozen_string_literal: true # Relegate internal functions. Make overriding navs easier. class Pagy private # Compose the aria label attribute for the nav def nav_aria_label_attribute(aria_label: nil) aria_label ||= I18n.translate('pagy.aria_label.nav', count: @last) %(aria-label="#{aria_label}") end...
ruby
MIT
fe1f35863e3bad60ef8731e298c7cb38af4e7af6
2026-01-04T15:44:39.884044Z
false
ddnexus/pagy
https://github.com/ddnexus/pagy/blob/fe1f35863e3bad60ef8731e298c7cb38af4e7af6/gem/lib/pagy/toolbox/helpers/support/a_lambda.rb
gem/lib/pagy/toolbox/helpers/support/a_lambda.rb
# frozen_string_literal: true class Pagy protected # Label for any page. Allow the customization of the output def page_label(page, **options) return page.to_s unless calendar? options[:format] ||= @options[:format] localize(starting_time_for(page.to_i), **options) # page could be a string end ...
ruby
MIT
fe1f35863e3bad60ef8731e298c7cb38af4e7af6
2026-01-04T15:44:39.884044Z
false
ddnexus/pagy
https://github.com/ddnexus/pagy/blob/fe1f35863e3bad60ef8731e298c7cb38af4e7af6/gem/lib/pagy/toolbox/helpers/bootstrap/previous_next_html.rb
gem/lib/pagy/toolbox/helpers/bootstrap/previous_next_html.rb
# frozen_string_literal: true class Pagy private # Return the enabled/disabled previous/next page anchor tag, embedded in the li tag def bootstrap_html_for(which, a_lambda) if send(which) %(<li class="page-item #{which}">#{ a_lambda.(send(which), I18n.translate("pagy.#{which}"), ...
ruby
MIT
fe1f35863e3bad60ef8731e298c7cb38af4e7af6
2026-01-04T15:44:39.884044Z
false
ddnexus/pagy
https://github.com/ddnexus/pagy/blob/fe1f35863e3bad60ef8731e298c7cb38af4e7af6/gem/lib/pagy/toolbox/helpers/bootstrap/input_nav_js.rb
gem/lib/pagy/toolbox/helpers/bootstrap/input_nav_js.rb
# frozen_string_literal: true require_relative 'previous_next_html' require_relative '../support/wrap_input_nav_js' class Pagy private # Javascript combo pagination for bootstrap: it returns a nav with a data-pagy attribute used by the pagy.js file def bootstrap_input_nav_js(classes: 'pagination', **) a_la...
ruby
MIT
fe1f35863e3bad60ef8731e298c7cb38af4e7af6
2026-01-04T15:44:39.884044Z
false
ddnexus/pagy
https://github.com/ddnexus/pagy/blob/fe1f35863e3bad60ef8731e298c7cb38af4e7af6/gem/lib/pagy/toolbox/helpers/bootstrap/series_nav.rb
gem/lib/pagy/toolbox/helpers/bootstrap/series_nav.rb
# frozen_string_literal: true require_relative 'previous_next_html' require_relative '../support/wrap_series_nav' class Pagy private # Pagination for bootstrap: it returns the html with the series of links to the pages def bootstrap_series_nav(classes: 'pagination', **) a_lambda = a_lambda(**) html ...
ruby
MIT
fe1f35863e3bad60ef8731e298c7cb38af4e7af6
2026-01-04T15:44:39.884044Z
false
ddnexus/pagy
https://github.com/ddnexus/pagy/blob/fe1f35863e3bad60ef8731e298c7cb38af4e7af6/gem/lib/pagy/toolbox/helpers/bootstrap/series_nav_js.rb
gem/lib/pagy/toolbox/helpers/bootstrap/series_nav_js.rb
# frozen_string_literal: true require_relative 'previous_next_html' require_relative '../support/wrap_series_nav_js' class Pagy private # Javascript pagination for bootstrap: it returns a nav with a data-pagy attribute used by the pagy.js file def bootstrap_series_nav_js(classes: 'pagination', **) a_lambda...
ruby
MIT
fe1f35863e3bad60ef8731e298c7cb38af4e7af6
2026-01-04T15:44:39.884044Z
false
ddnexus/pagy
https://github.com/ddnexus/pagy/blob/fe1f35863e3bad60ef8731e298c7cb38af4e7af6/gem/lib/pagy/toolbox/helpers/bulma/previous_next_html.rb
gem/lib/pagy/toolbox/helpers/bulma/previous_next_html.rb
# frozen_string_literal: true class Pagy private # Return the enabled/disabled previous/next page anchor tag def bulma_html_for(which, a_lambda) %(<li>#{ if send(which) a_lambda.(send(which), I18n.translate("pagy.#{which}"), classes: "pagination-#{which}", ...
ruby
MIT
fe1f35863e3bad60ef8731e298c7cb38af4e7af6
2026-01-04T15:44:39.884044Z
false
ddnexus/pagy
https://github.com/ddnexus/pagy/blob/fe1f35863e3bad60ef8731e298c7cb38af4e7af6/gem/lib/pagy/toolbox/helpers/bulma/input_nav_js.rb
gem/lib/pagy/toolbox/helpers/bulma/input_nav_js.rb
# frozen_string_literal: true require_relative 'previous_next_html' require_relative '../support/wrap_input_nav_js' class Pagy private # Javascript combo pagination for bulma: it returns a nav with a data-pagy attribute used by the pagy.js file def bulma_input_nav_js(classes: 'pagination', **) a_lambda = a...
ruby
MIT
fe1f35863e3bad60ef8731e298c7cb38af4e7af6
2026-01-04T15:44:39.884044Z
false
ddnexus/pagy
https://github.com/ddnexus/pagy/blob/fe1f35863e3bad60ef8731e298c7cb38af4e7af6/gem/lib/pagy/toolbox/helpers/bulma/series_nav.rb
gem/lib/pagy/toolbox/helpers/bulma/series_nav.rb
# frozen_string_literal: true require_relative 'previous_next_html' require_relative '../support/wrap_series_nav' class Pagy private # Pagination for bulma: it returns the html with the series of links to the pages def bulma_series_nav(classes: 'pagination', **) a_lambda = a_lambda(**) html = %(<ul...
ruby
MIT
fe1f35863e3bad60ef8731e298c7cb38af4e7af6
2026-01-04T15:44:39.884044Z
false
ddnexus/pagy
https://github.com/ddnexus/pagy/blob/fe1f35863e3bad60ef8731e298c7cb38af4e7af6/gem/lib/pagy/toolbox/helpers/bulma/series_nav_js.rb
gem/lib/pagy/toolbox/helpers/bulma/series_nav_js.rb
# frozen_string_literal: true require_relative 'previous_next_html' require_relative '../support/wrap_series_nav_js' class Pagy private # Javascript pagination for bulma: it returns a nav with a data-pagy attribute used by the Pagy.nav javascript def bulma_series_nav_js(classes: 'pagination', **) a_lambda ...
ruby
MIT
fe1f35863e3bad60ef8731e298c7cb38af4e7af6
2026-01-04T15:44:39.884044Z
false
ddnexus/pagy
https://github.com/ddnexus/pagy/blob/fe1f35863e3bad60ef8731e298c7cb38af4e7af6/gem/lib/pagy/toolbox/paginators/keyset.rb
gem/lib/pagy/toolbox/paginators/keyset.rb
# frozen_string_literal: true class Pagy module KeysetPaginator module_function # Return Pagy::Keyset instance and paginated records def paginate(set, options) options[:page] ||= options[:request].resolve_page(force_integer: false) # allow nil options[:limit] = options[:request].resolve_lim...
ruby
MIT
fe1f35863e3bad60ef8731e298c7cb38af4e7af6
2026-01-04T15:44:39.884044Z
false
ddnexus/pagy
https://github.com/ddnexus/pagy/blob/fe1f35863e3bad60ef8731e298c7cb38af4e7af6/gem/lib/pagy/toolbox/paginators/countless.rb
gem/lib/pagy/toolbox/paginators/countless.rb
# frozen_string_literal: true class Pagy module CountlessPaginator module_function # Return the Offset::Countless instance and records def paginate(collection, options) options[:page] ||= options[:request].resolve_page(force_integer: false) # accept nil and strings if options[:page].is_a?(St...
ruby
MIT
fe1f35863e3bad60ef8731e298c7cb38af4e7af6
2026-01-04T15:44:39.884044Z
false
ddnexus/pagy
https://github.com/ddnexus/pagy/blob/fe1f35863e3bad60ef8731e298c7cb38af4e7af6/gem/lib/pagy/toolbox/paginators/calendar.rb
gem/lib/pagy/toolbox/paginators/calendar.rb
# frozen_string_literal: true class Pagy module CalendarPaginator module_function # Take a collection and a configuration Hash and return an array with 3 items: [calendar, pagy, results] def paginate(context, collection, config) context.instance_eval do allowed_options = Calendar::UNITS + ...
ruby
MIT
fe1f35863e3bad60ef8731e298c7cb38af4e7af6
2026-01-04T15:44:39.884044Z
false
ddnexus/pagy
https://github.com/ddnexus/pagy/blob/fe1f35863e3bad60ef8731e298c7cb38af4e7af6/gem/lib/pagy/toolbox/paginators/offset.rb
gem/lib/pagy/toolbox/paginators/offset.rb
# frozen_string_literal: true require_relative '../../modules/abilities/countable' class Pagy module OffsetPaginator module_function # Return the Pagy::Offset instance and results def paginate(collection, options) options[:page] ||= options[:request].resolve_page options[:limit] = option...
ruby
MIT
fe1f35863e3bad60ef8731e298c7cb38af4e7af6
2026-01-04T15:44:39.884044Z
false
ddnexus/pagy
https://github.com/ddnexus/pagy/blob/fe1f35863e3bad60ef8731e298c7cb38af4e7af6/gem/lib/pagy/toolbox/paginators/method.rb
gem/lib/pagy/toolbox/paginators/method.rb
# frozen_string_literal: true require_relative '../../classes/request' class Pagy paginators = { offset: :OffsetPaginator, countless: :CountlessPaginator, countish: :CountishPaginator, keyset: :KeysetPaginator, ...
ruby
MIT
fe1f35863e3bad60ef8731e298c7cb38af4e7af6
2026-01-04T15:44:39.884044Z
false
ddnexus/pagy
https://github.com/ddnexus/pagy/blob/fe1f35863e3bad60ef8731e298c7cb38af4e7af6/gem/lib/pagy/toolbox/paginators/searchkick.rb
gem/lib/pagy/toolbox/paginators/searchkick.rb
# frozen_string_literal: true require_relative '../../modules/searcher' class Pagy module SearchkickPaginator module_function # Paginate from the search object def paginate(search, options) if search.is_a?(Search::Arguments) # The search is the array of pagy_search arguments Searc...
ruby
MIT
fe1f35863e3bad60ef8731e298c7cb38af4e7af6
2026-01-04T15:44:39.884044Z
false
ddnexus/pagy
https://github.com/ddnexus/pagy/blob/fe1f35863e3bad60ef8731e298c7cb38af4e7af6/gem/lib/pagy/toolbox/paginators/meilisearch.rb
gem/lib/pagy/toolbox/paginators/meilisearch.rb
# frozen_string_literal: true require_relative '../../modules/searcher' class Pagy module MeilisearchPaginator module_function # Paginate from the search object def paginate(search, options) if search.is_a?(Search::Arguments) # The search is the array of pagy_search arguments Sear...
ruby
MIT
fe1f35863e3bad60ef8731e298c7cb38af4e7af6
2026-01-04T15:44:39.884044Z
false
ddnexus/pagy
https://github.com/ddnexus/pagy/blob/fe1f35863e3bad60ef8731e298c7cb38af4e7af6/gem/lib/pagy/toolbox/paginators/elasticsearch_rails.rb
gem/lib/pagy/toolbox/paginators/elasticsearch_rails.rb
# frozen_string_literal: true require_relative '../../modules/searcher' class Pagy module ElasticsearchRailsPaginator module_function # Paginate from the search object def paginate(search, options) if search.is_a?(Search::Arguments) # The search is the array of pagy_search arguments ...
ruby
MIT
fe1f35863e3bad60ef8731e298c7cb38af4e7af6
2026-01-04T15:44:39.884044Z
false
ddnexus/pagy
https://github.com/ddnexus/pagy/blob/fe1f35863e3bad60ef8731e298c7cb38af4e7af6/gem/lib/pagy/toolbox/paginators/keynav_js.rb
gem/lib/pagy/toolbox/paginators/keynav_js.rb
# frozen_string_literal: true require_relative '../../../pagy/modules/b64' class Pagy module KeynavJsPaginator module_function # Return the Pagy::Keyset::Keynav instance and paginated records. # Fall back to :countless if the :page has no client data. def paginate(set, options) page = options...
ruby
MIT
fe1f35863e3bad60ef8731e298c7cb38af4e7af6
2026-01-04T15:44:39.884044Z
false
ddnexus/pagy
https://github.com/ddnexus/pagy/blob/fe1f35863e3bad60ef8731e298c7cb38af4e7af6/gem/lib/pagy/toolbox/paginators/countish.rb
gem/lib/pagy/toolbox/paginators/countish.rb
# frozen_string_literal: true require_relative '../../modules/abilities/countable' class Pagy module CountishPaginator module_function # Return the Offset::Countish instance and records def paginate(collection, options) options[:page] ||= options[:request].resolve_page(force_integer: false) ...
ruby
MIT
fe1f35863e3bad60ef8731e298c7cb38af4e7af6
2026-01-04T15:44:39.884044Z
false
ddnexus/pagy
https://github.com/ddnexus/pagy/blob/fe1f35863e3bad60ef8731e298c7cb38af4e7af6/gem/lib/pagy/classes/exceptions.rb
gem/lib/pagy/classes/exceptions.rb
# frozen_string_literal: true class Pagy # Generic option error class OptionError < ArgumentError attr_reader :pagy, :option, :value # Set the options and prepare the message def initialize(pagy, option, description, value) @pagy = pagy @option = option @value = value super(...
ruby
MIT
fe1f35863e3bad60ef8731e298c7cb38af4e7af6
2026-01-04T15:44:39.884044Z
false
ddnexus/pagy
https://github.com/ddnexus/pagy/blob/fe1f35863e3bad60ef8731e298c7cb38af4e7af6/gem/lib/pagy/classes/request.rb
gem/lib/pagy/classes/request.rb
# frozen_string_literal: true class Pagy # Decouple the request from the env, allowing non-rack apps to use pagy by passing a hash. # Resolve the :page and :limit options from params. class Request def initialize(options) @options = options request = @options[:request] @base_url, @path, @p...
ruby
MIT
fe1f35863e3bad60ef8731e298c7cb38af4e7af6
2026-01-04T15:44:39.884044Z
false
ddnexus/pagy
https://github.com/ddnexus/pagy/blob/fe1f35863e3bad60ef8731e298c7cb38af4e7af6/gem/lib/pagy/classes/keyset/keyset.rb
gem/lib/pagy/classes/keyset/keyset.rb
# frozen_string_literal: true require 'json' require_relative '../../modules/b64' class Pagy # Implement wicked-fast keyset pagination for big data class Keyset < Pagy # Autoload adapters: files are loaded only when const_get accesses them module Adapters path = Pathname.new(__dir__) autoload ...
ruby
MIT
fe1f35863e3bad60ef8731e298c7cb38af4e7af6
2026-01-04T15:44:39.884044Z
false
ddnexus/pagy
https://github.com/ddnexus/pagy/blob/fe1f35863e3bad60ef8731e298c7cb38af4e7af6/gem/lib/pagy/classes/keyset/keynav.rb
gem/lib/pagy/classes/keyset/keynav.rb
# frozen_string_literal: true class Pagy class Keyset # Use keyset pagination with resources for all the frontend helpers class Keynav < Keyset # Avoid conflicts between filter arguments in composite SQL fragments PRIOR_PREFIX = 'prior_' PAGE_PREFIX = 'page_' # Define empty subclass...
ruby
MIT
fe1f35863e3bad60ef8731e298c7cb38af4e7af6
2026-01-04T15:44:39.884044Z
false
ddnexus/pagy
https://github.com/ddnexus/pagy/blob/fe1f35863e3bad60ef8731e298c7cb38af4e7af6/gem/lib/pagy/classes/keyset/adapters/active_record.rb
gem/lib/pagy/classes/keyset/adapters/active_record.rb
# frozen_string_literal: true class Pagy class Keyset module Adapters # Keyset adapter for ActiveRecord module ActiveRecord # Extract the keyset from the set def extract_keyset @set.order_values.each_with_object({}) do |node, keyset| keyset[node.value.name.to_sym...
ruby
MIT
fe1f35863e3bad60ef8731e298c7cb38af4e7af6
2026-01-04T15:44:39.884044Z
false
ddnexus/pagy
https://github.com/ddnexus/pagy/blob/fe1f35863e3bad60ef8731e298c7cb38af4e7af6/gem/lib/pagy/classes/keyset/adapters/sequel.rb
gem/lib/pagy/classes/keyset/adapters/sequel.rb
# frozen_string_literal: true class Pagy class Keyset module Adapters # Keyset adapter for sequel module Sequel # Extract the keyset from the set def extract_keyset return {} unless @set.opts[:order] @set.opts[:order].each_with_object({}) do |item, keyset| ...
ruby
MIT
fe1f35863e3bad60ef8731e298c7cb38af4e7af6
2026-01-04T15:44:39.884044Z
false
ddnexus/pagy
https://github.com/ddnexus/pagy/blob/fe1f35863e3bad60ef8731e298c7cb38af4e7af6/gem/lib/pagy/classes/offset/countless.rb
gem/lib/pagy/classes/offset/countless.rb
# frozen_string_literal: true class Pagy class Offset # Offset pagination without a count class Countless < Offset def initialize(**) assign_options(**) assign_and_check(limit: 1, page: 1) @page = upto_max_pages(@page) @last = upto_max_pages(@options[:last]) unless @opti...
ruby
MIT
fe1f35863e3bad60ef8731e298c7cb38af4e7af6
2026-01-04T15:44:39.884044Z
false
ddnexus/pagy
https://github.com/ddnexus/pagy/blob/fe1f35863e3bad60ef8731e298c7cb38af4e7af6/gem/lib/pagy/classes/offset/offset.rb
gem/lib/pagy/classes/offset/offset.rb
# frozen_string_literal: true require_relative '../../modules/abilities/shiftable' require_relative '../../modules/abilities/rangeable' class Pagy # Implements Offset Pagination class Offset < Pagy DEFAULT = { page: 1 }.freeze autoload :Countless, Pathname.new(__dir__).join('countless') autoload :Cou...
ruby
MIT
fe1f35863e3bad60ef8731e298c7cb38af4e7af6
2026-01-04T15:44:39.884044Z
false
ddnexus/pagy
https://github.com/ddnexus/pagy/blob/fe1f35863e3bad60ef8731e298c7cb38af4e7af6/gem/lib/pagy/classes/offset/search.rb
gem/lib/pagy/classes/offset/search.rb
# frozen_string_literal: true class Pagy module Search class Arguments < Array def respond_to_missing?(*) = true def method_missing(*) = push(*) end # Collect the search arguments to pass to the actual search def pagy_search(term = nil, **options, &block) Arguments.new([self, term...
ruby
MIT
fe1f35863e3bad60ef8731e298c7cb38af4e7af6
2026-01-04T15:44:39.884044Z
false
ddnexus/pagy
https://github.com/ddnexus/pagy/blob/fe1f35863e3bad60ef8731e298c7cb38af4e7af6/gem/lib/pagy/classes/offset/countish.rb
gem/lib/pagy/classes/offset/countish.rb
# frozen_string_literal: true class Pagy class Offset # Offset pagination with memoized count class Countish < Offset protected # Return page+count or page+count+epoch def compose_page_param(page) value = "#{page || 1}+#{@count}" value << "+#{@options[:epoch]}" if @options...
ruby
MIT
fe1f35863e3bad60ef8731e298c7cb38af4e7af6
2026-01-04T15:44:39.884044Z
false
ddnexus/pagy
https://github.com/ddnexus/pagy/blob/fe1f35863e3bad60ef8731e298c7cb38af4e7af6/gem/lib/pagy/classes/calendar/unit.rb
gem/lib/pagy/classes/calendar/unit.rb
# frozen_string_literal: true require_relative '../../modules/abilities/shiftable' require_relative '../../modules/abilities/rangeable' class Pagy class Calendar # Base class for time units subclasses (Year, Quarter, Month, Week, Day) # # To define a "bimester" unit you should: # - Define a `Pagy::C...
ruby
MIT
fe1f35863e3bad60ef8731e298c7cb38af4e7af6
2026-01-04T15:44:39.884044Z
false
ddnexus/pagy
https://github.com/ddnexus/pagy/blob/fe1f35863e3bad60ef8731e298c7cb38af4e7af6/gem/lib/pagy/classes/calendar/calendar.rb
gem/lib/pagy/classes/calendar/calendar.rb
# frozen_string_literal: true require 'active_support' require 'active_support/core_ext/time' require 'active_support/core_ext/date_and_time/calculations' require 'active_support/core_ext/numeric/time' require 'active_support/core_ext/integer/time' class Pagy # Calendar class class Calendar < Hash path = Path...
ruby
MIT
fe1f35863e3bad60ef8731e298c7cb38af4e7af6
2026-01-04T15:44:39.884044Z
false
ddnexus/pagy
https://github.com/ddnexus/pagy/blob/fe1f35863e3bad60ef8731e298c7cb38af4e7af6/gem/lib/pagy/classes/calendar/day.rb
gem/lib/pagy/classes/calendar/day.rb
# frozen_string_literal: true class Pagy class Calendar class Day < Unit DEFAULT = { slots: 31, compact: true, order: :asc, format: '%d' }.freeze protected def assign_unit_variables super @initial = @starting.beginning_...
ruby
MIT
fe1f35863e3bad60ef8731e298c7cb38af4e7af6
2026-01-04T15:44:39.884044Z
false
ddnexus/pagy
https://github.com/ddnexus/pagy/blob/fe1f35863e3bad60ef8731e298c7cb38af4e7af6/gem/lib/pagy/classes/calendar/quarter.rb
gem/lib/pagy/classes/calendar/quarter.rb
# frozen_string_literal: true class Pagy # :nodoc: class Calendar # :nodoc: class Quarter < Unit DEFAULT = { slots: 4, compact: true, order: :asc, format: 'Q%q' }.freeze # '%q' token protected # The label for any page, with the substit...
ruby
MIT
fe1f35863e3bad60ef8731e298c7cb38af4e7af6
2026-01-04T15:44:39.884044Z
false
ddnexus/pagy
https://github.com/ddnexus/pagy/blob/fe1f35863e3bad60ef8731e298c7cb38af4e7af6/gem/lib/pagy/classes/calendar/month.rb
gem/lib/pagy/classes/calendar/month.rb
# frozen_string_literal: true class Pagy # :nodoc: class Calendar # :nodoc: class Month < Unit DEFAULT = { slots: 12, compact: true, order: :asc, format: '%b' }.freeze protected def assign_unit_variables super @initial ...
ruby
MIT
fe1f35863e3bad60ef8731e298c7cb38af4e7af6
2026-01-04T15:44:39.884044Z
false
ddnexus/pagy
https://github.com/ddnexus/pagy/blob/fe1f35863e3bad60ef8731e298c7cb38af4e7af6/gem/lib/pagy/classes/calendar/week.rb
gem/lib/pagy/classes/calendar/week.rb
# frozen_string_literal: true class Pagy class Calendar class Week < Unit DEFAULT = { order: :asc, format: '%Y-%W' }.freeze protected def assign_unit_variables super @initial = @starting.beginning_of_week @final = @ending.next_week.beginning_of_w...
ruby
MIT
fe1f35863e3bad60ef8731e298c7cb38af4e7af6
2026-01-04T15:44:39.884044Z
false
ddnexus/pagy
https://github.com/ddnexus/pagy/blob/fe1f35863e3bad60ef8731e298c7cb38af4e7af6/gem/lib/pagy/classes/calendar/year.rb
gem/lib/pagy/classes/calendar/year.rb
# frozen_string_literal: true class Pagy # :nodoc: class Calendar # :nodoc: # Year unit subclass class Year < Unit DEFAULT = { slots: 10, compact: true, order: :asc, format: '%Y' }.freeze protected # Set up the calendar variables ...
ruby
MIT
fe1f35863e3bad60ef8731e298c7cb38af4e7af6
2026-01-04T15:44:39.884044Z
false
ddnexus/pagy
https://github.com/ddnexus/pagy/blob/fe1f35863e3bad60ef8731e298c7cb38af4e7af6/gem/config/pagy.rb
gem/config/pagy.rb
# frozen_string_literal: true # Pagy initializer file (43.2.2) # See https://ddnexus.github.io/pagy/resources/initializer/ ############ Global Options ################################################################ # See https://ddnexus.github.io/pagy/toolbox/options/ for details. # Add your global options below. Th...
ruby
MIT
fe1f35863e3bad60ef8731e298c7cb38af4e7af6
2026-01-04T15:44:39.884044Z
false
thoughtbot/suspenders
https://github.com/thoughtbot/suspenders/blob/466e676e3825a9c1ed2ab14af7ce2324d6b6e5fd/spec/suspenders_spec.rb
spec/suspenders_spec.rb
# frozen_string_literal: true RSpec.describe Suspenders do it "has a version number" do expect(Suspenders::VERSION).not_to be nil end describe Suspenders::CLI do let(:stub_success) { allow_any_instance_of(Suspenders::CLI).to receive(:system).and_return(true) } before do stub_success...
ruby
MIT
466e676e3825a9c1ed2ab14af7ce2324d6b6e5fd
2026-01-04T15:47:31.870949Z
false
thoughtbot/suspenders
https://github.com/thoughtbot/suspenders/blob/466e676e3825a9c1ed2ab14af7ce2324d6b6e5fd/spec/spec_helper.rb
spec/spec_helper.rb
# frozen_string_literal: true require "suspenders" RSpec.configure do |config| # Enable flags like --only-failures and --next-failure config.example_status_persistence_file_path = ".rspec_status" # Disable RSpec exposing methods globally on `Module` and `main` config.disable_monkey_patching! config.expect...
ruby
MIT
466e676e3825a9c1ed2ab14af7ce2324d6b6e5fd
2026-01-04T15:47:31.870949Z
false
thoughtbot/suspenders
https://github.com/thoughtbot/suspenders/blob/466e676e3825a9c1ed2ab14af7ce2324d6b6e5fd/lib/suspenders.rb
lib/suspenders.rb
# frozen_string_literal: true require_relative "suspenders/version" require_relative "suspenders/cli" module Suspenders class Error < StandardError; end # Your code goes here... end
ruby
MIT
466e676e3825a9c1ed2ab14af7ce2324d6b6e5fd
2026-01-04T15:47:31.870949Z
false
thoughtbot/suspenders
https://github.com/thoughtbot/suspenders/blob/466e676e3825a9c1ed2ab14af7ce2324d6b6e5fd/lib/suspenders/version.rb
lib/suspenders/version.rb
# frozen_string_literal: true module Suspenders VERSION = "20251219.0" MINIMUM_RUBY_VERSION = ">= 3.2.0" end
ruby
MIT
466e676e3825a9c1ed2ab14af7ce2324d6b6e5fd
2026-01-04T15:47:31.870949Z
false
thoughtbot/suspenders
https://github.com/thoughtbot/suspenders/blob/466e676e3825a9c1ed2ab14af7ce2324d6b6e5fd/lib/suspenders/cli.rb
lib/suspenders/cli.rb
# frozen_string_literal: true module Suspenders # Command-line interface for generating Rails applications with Suspenders. # This class handles the creation of new Rails apps using a custom template # and predefined configuration options. class CLI # Base options passed to the Rails generator for all new ...
ruby
MIT
466e676e3825a9c1ed2ab14af7ce2324d6b6e5fd
2026-01-04T15:47:31.870949Z
false
thoughtbot/suspenders
https://github.com/thoughtbot/suspenders/blob/466e676e3825a9c1ed2ab14af7ce2324d6b6e5fd/lib/templates/web.rb
lib/templates/web.rb
# Methods like `copy_file` will accept relative paths to the template's location. def source_paths Array(super) + [__dir__] end def install_gems gem "inline_svg" gem "sidekiq" gem "strong_migrations" gem_group :test do # TODO: How can we ensure we're notified of new releases? gem "action_dispatch-te...
ruby
MIT
466e676e3825a9c1ed2ab14af7ce2324d6b6e5fd
2026-01-04T15:47:31.870949Z
false
thoughtbot/suspenders
https://github.com/thoughtbot/suspenders/blob/466e676e3825a9c1ed2ab14af7ce2324d6b6e5fd/lib/templates/spec/factories_spec.rb
lib/templates/spec/factories_spec.rb
require "rails_helper" RSpec.describe "Factories" do it "has valid factoties" do FactoryBot.lint traits: true end end
ruby
MIT
466e676e3825a9c1ed2ab14af7ce2324d6b6e5fd
2026-01-04T15:47:31.870949Z
false
thoughtbot/suspenders
https://github.com/thoughtbot/suspenders/blob/466e676e3825a9c1ed2ab14af7ce2324d6b6e5fd/lib/templates/spec/support/driver.rb
lib/templates/spec/support/driver.rb
RSpec.configure do |config| config.before(:each, type: :system) do driven_by :selenium, using: :headless_chrome, screen_size: [1400, 1400] end end
ruby
MIT
466e676e3825a9c1ed2ab14af7ce2324d6b6e5fd
2026-01-04T15:47:31.870949Z
false
thoughtbot/suspenders
https://github.com/thoughtbot/suspenders/blob/466e676e3825a9c1ed2ab14af7ce2324d6b6e5fd/lib/templates/spec/support/shoulda_matchers.rb
lib/templates/spec/support/shoulda_matchers.rb
Shoulda::Matchers.configure do |config| config.integrate do |with| with.test_framework :rspec with.library :rails end end
ruby
MIT
466e676e3825a9c1ed2ab14af7ce2324d6b6e5fd
2026-01-04T15:47:31.870949Z
false
thoughtbot/suspenders
https://github.com/thoughtbot/suspenders/blob/466e676e3825a9c1ed2ab14af7ce2324d6b6e5fd/lib/templates/spec/support/i18n.rb
lib/templates/spec/support/i18n.rb
RSpec.configure do |config| config.include ActionView::Helpers::TranslationHelper end
ruby
MIT
466e676e3825a9c1ed2ab14af7ce2324d6b6e5fd
2026-01-04T15:47:31.870949Z
false
thoughtbot/suspenders
https://github.com/thoughtbot/suspenders/blob/466e676e3825a9c1ed2ab14af7ce2324d6b6e5fd/lib/templates/spec/support/factory_bot.rb
lib/templates/spec/support/factory_bot.rb
RSpec.configure do |config| config.include FactoryBot::Syntax::Methods end
ruby
MIT
466e676e3825a9c1ed2ab14af7ce2324d6b6e5fd
2026-01-04T15:47:31.870949Z
false
thoughtbot/suspenders
https://github.com/thoughtbot/suspenders/blob/466e676e3825a9c1ed2ab14af7ce2324d6b6e5fd/lib/templates/spec/support/action_mailer.rb
lib/templates/spec/support/action_mailer.rb
RSpec.configure do |config| # https://guides.rubyonrails.org/testing.html#the-basic-test-case # # The ActionMailer::Base.deliveries array is only reset automatically in # ActionMailer::TestCase and ActionDispatch::IntegrationTest tests. If # you want to have a clean slate outside these test cases, you can res...
ruby
MIT
466e676e3825a9c1ed2ab14af7ce2324d6b6e5fd
2026-01-04T15:47:31.870949Z
false
thoughtbot/suspenders
https://github.com/thoughtbot/suspenders/blob/466e676e3825a9c1ed2ab14af7ce2324d6b6e5fd/lib/templates/lib/development/seeder.rb
lib/templates/lib/development/seeder.rb
# This file should ensure the existence of records required to run the application in development. # The code here should be idempotent so that it can be executed at any point in development. # The data can then be loaded with the bin/rails development:db:seed command. module Development class Seeder def self.lo...
ruby
MIT
466e676e3825a9c1ed2ab14af7ce2324d6b6e5fd
2026-01-04T15:47:31.870949Z
false
thoughtbot/suspenders
https://github.com/thoughtbot/suspenders/blob/466e676e3825a9c1ed2ab14af7ce2324d6b6e5fd/lib/templates/config/initializers/sidekiq.rb
lib/templates/config/initializers/sidekiq.rb
# https://github.com/sidekiq/sidekiq/wiki/Heroku SIDEKIQ_REDIS_CONFIGURATION = { url: ENV.fetch(ENV.fetch("REDIS_PROVIDER", "REDIS_URL"), nil), # use REDIS_PROVIDER for Redis environment variable name, defaulting to REDIS_URL ssl_params: {verify_mode: OpenSSL::SSL::VERIFY_NONE} # we must trust Heroku and AWS here ...
ruby
MIT
466e676e3825a9c1ed2ab14af7ce2324d6b6e5fd
2026-01-04T15:47:31.870949Z
false
kneath/kss
https://github.com/kneath/kss/blob/b0791708cb397f5e8995a855af0d1a8b0aa89a2e/test/comment_parser_test.rb
test/comment_parser_test.rb
require 'test/helper' class CommentParser < Kss::Test def setup loc = 'test/fixtures/comments.txt' @parsed_comments = Kss::CommentParser.new(loc).blocks end test "detects single-line comment syntax" do assert Kss::CommentParser.single_line_comment?("// yuuuuup") assert !Kss::CommentParser.singl...
ruby
MIT
b0791708cb397f5e8995a855af0d1a8b0aa89a2e
2026-01-04T15:47:37.844420Z
false