Class: RESTHelpers::BooleanParam

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

Class Method Summary collapse

Class Method Details

.value(s) ⇒ Object



436
437
438
439
440
441
442
443
444
445
446
# File 'backend/app/lib/rest.rb', line 436

def self.value(s)
  if s.nil?
    nil
  elsif s.to_s.downcase == 'true'
    true
  elsif s.to_s.downcase == 'false'
    false
  else
    raise ArgumentError.new("Invalid boolean value: #{s}")
  end
end