Class: RESTHelpers::PageSize

Inherits:
Object
  • Object
show all
Defined in:
backend/app/lib/rest.rb

Class Method Summary collapse

Class Method Details

.value(s) ⇒ Object



420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
# File 'backend/app/lib/rest.rb', line 420

def self.value(s)
  val = Integer(s)

  if val < 0
    raise ArgumentError.new("Invalid non-negative integer value: #{s}")
  end

  if val > AppConfig[:max_page_size].to_i
    Log.warn("Requested page size of #{val} exceeds the maximum allowable of #{AppConfig[:max_page_size]}." +
             "  It has been reduced to the maximum.")

    val = AppConfig[:max_page_size].to_i
  end

  val
end