Sha256: 5ff5aded961202507d08dc99d18587ba404b9cbb3a5043903798af063cc9ff42

Contents?: true

Size: 423 Bytes

Versions: 10

Compression:

Stored size: 423 Bytes

Contents

# frozen_string_literal: true

class Pagy

  # generic variable error
  class VariableError < ArgumentError
    attr_reader :pagy

    def initialize(pagy)
      super
      @pagy = pagy
    end

    def variable
      message =~ /expected :(\w+)/
      Regexp.last_match(1)&.to_sym
    end

    def value
      pagy.vars[variable]
    end
  end

  # specific overflow error
  class OverflowError < VariableError; end

end

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
cm-admin-1.5.22 vendor/bundle/ruby/3.3.0/gems/pagy-4.11.0/lib/pagy/exceptions.rb
cm-admin-1.5.21 vendor/bundle/ruby/3.3.0/gems/pagy-4.11.0/lib/pagy/exceptions.rb
cm-admin-1.5.20 vendor/bundle/ruby/3.3.0/gems/pagy-4.11.0/lib/pagy/exceptions.rb
pagy-4.11.0 lib/pagy/exceptions.rb
pagy-4.10.2 lib/pagy/exceptions.rb
pagy-4.10.1 lib/pagy/exceptions.rb
pagy-4.10.0 lib/pagy/exceptions.rb
pagy-4.9.0 lib/pagy/exceptions.rb
pagy-4.8.1 lib/pagy/exceptions.rb
pagy-4.8.0 lib/pagy/exceptions.rb