ruby if else one line code example
Example 1: ruby if statement one line
if_condition ? if_statement : else_statement
Example 2: rails if else assignment one liner
@item.property = params[:property] ? true : false
Example 3: ruby shorthand if
today == ChristmasEve ? (puts "Santa's On His Way!") : (puts "Snow")