Module: Uchi::Pagy::Rangeable

Included in:
Offset
Defined in:
lib/uchi/pagy/modules/abilities/rangeable.rb

Overview

Add method supporting range checking, range error and rescue

Instance Method Summary collapse

Instance Method Details

#in_range?Boolean

Check if in range

Returns:

  • (Boolean)

Raises:



8
9
10
11
12
13
14
# File 'lib/uchi/pagy/modules/abilities/rangeable.rb', line 8

def in_range?
  return @in_range if defined?(@in_range) || (@in_range = yield)
  raise RangeError.new(self, :page, "in 1..#{@last}", @page) if @options[:raise_range_error]

  assign_empty_page_variables
  false
end