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



455
456
457
458
459
460
461
462
463
464
465
# File 'backend/app/lib/rest.rb', line 455

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