Class: RESTHelpers::IdSet

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

Class Method Summary collapse

Class Method Details

.value(val) ⇒ Object



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

def self.value(val)
  vals = val.is_a?(Array) ? val : val.split(/,/)

  result = vals.map {|elt| Integer(elt)}.uniq

  if result.length > AppConfig[:max_page_size].to_i
    raise ArgumentError.new("ID set cannot contain more than #{AppConfig[:max_page_size]}n IDs")
  end

  result
end