Sha256: e66454a9100b4418101dcf9ef2e1e18724bbf3e87056efdac9c979550503f663

Contents?: true

Size: 326 Bytes

Versions: 4

Compression:

Stored size: 326 Bytes

Contents

class Pagy

  class VariableError < ArgumentError
    attr_reader :pagy

    def initialize(pagy)
      super
      @pagy = pagy
    end

    def variable
      message =~ /expected :([\w]+)/
      $1.to_sym if $1
    end

    def value
      pagy.vars[variable]
    end
  end

  class OverflowError < VariableError; end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
pagy-3.14.0 lib/pagy/exceptions.rb
pagy-3.13.0 lib/pagy/exceptions.rb
pagy-4.1.0 lib/pagy/exceptions.rb
pagy-4.0.0 lib/pagy/exceptions.rb