Class: RESTHelpers::PageSize

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

Class Method Summary (collapse)

Class Method Details

+ (Object) value(s)



263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
# File 'backend/app/lib/rest.rb', line 263

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