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



401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
# File 'backend/app/lib/rest.rb', line 401

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