I love ruby magic code and I want try to get value from boolean after null check without using call string again.
I have column ismale structure tinyin(Boolean) and have null
if null == "Unknown"
if true == "Male"
if false == "Female"
I have
@user.ismale.nil? ? "Unknown" : @user.ismale ? "Male" : "Female"
I dont want to call @user.ismale 2 times
@user.ismale.nil? ? "Unknown" : ? "Male" : "Female"
can I get this magic code ?
Thank you