I have a value that will be one of four things: boolean true, boolean false, the string \"true\", or the string \"false\". I want to convert the string to a boolean if it i
Don't think too much:
bool_or_string.to_s == "true"
So,
"true".to_s == "true" #true "false".to_s == "true" #false true.to_s == "true" #true false.to_s == "true" #false
You could also add ".downcase," if you are worried about capital letters.