class Swagger::Boolean

Constants

FALSE_REGEXP
TRUE_REGEXP

Public Class Methods

coerce(obj) click to toggle source
# File lib/swagger/boolean.rb, line 6
def self.coerce(obj)
  val = obj.to_s.downcase
  return true if val.match(TRUE_REGEXP)
  return false if val.match(FALSE_REGEXP)
  raise ArgumentError, "#{obj} cannot be coerced to a boolean"
end