Exception: Pagy::VariableError

Inherits:
ArgumentError
  • Object
show all
Defined in:
lib/pagy/exceptions.rb

Overview

generic variable error

Direct Known Subclasses

OverflowError

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(pagy) ⇒ VariableError

Returns a new instance of VariableError.



9
10
11
12
# File 'lib/pagy/exceptions.rb', line 9

def initialize(pagy)
  super
  @pagy = pagy
end

Instance Attribute Details

#pagyObject (readonly)

Returns the value of attribute pagy.



7
8
9
# File 'lib/pagy/exceptions.rb', line 7

def pagy
  @pagy
end

Instance Method Details

#valueObject



19
# File 'lib/pagy/exceptions.rb', line 19

def value = pagy.vars[variable]

#variableObject



14
15
16
17
# File 'lib/pagy/exceptions.rb', line 14

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