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



440
441
442
443
444
445
446
447
448
449
450
# File 'backend/app/lib/rest.rb', line 440

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