As far as i know there is no built in way of casting strings to booleans,
but if your strings only consist of 'true' and 'false' you could shorten your method to the following:
def to_boolean(str)
str == 'true'
end
As far as i know there is no built in way of casting strings to booleans,
but if your strings only consist of 'true' and 'false' you could shorten your method to the following:
def to_boolean(str)
str == 'true'
end