class Highway::Steps::Types::Bool
This class represents a boolean parameter type.
Public Instance Methods
typecheck(value)
click to toggle source
Typecheck and coerce a value if possible.
This method returns a typechecked and coerced value or `nil` if value has invalid type and can't be coerced.
@param value [Object] A value.
@return [Boolean, nil]
# File lib/highway/steps/types/bool.rb, line 25 def typecheck(value) case value when ::TrueClass, 1, "1", "true", "yes" then true when ::FalseClass, 0, "0", "false", "no" then false end end