Reputation: 7622
I have a condition like:
if connection
if "name" == connection.name
...
end
end
connection
may have nil
value initially, so I am not able to check if connection && "name" == connection.name
How can I simplify the condition efficiently?
Upvotes: 2
Views: 304
Reputation: 20950
unless connection.nil? || connection.name != "name"
#...Statements
end
Upvotes: 2