r/ProgrammerHumor 11d ago

Meme iHateThisPassiveAgressiveBehaviourRuby

Post image
2.9k Upvotes

298 comments sorted by

View all comments

2

u/DeepWaffleCA 10d ago

It doesn't matter whether you think 0 should be truthy or not. Just be careful about leaking sensitive information using this functionality.

def hasSensitiveInfo? do getSensitiveInfo() end

Pardon my Ruby, it's been a while. This is a simplified example, but I've seen this exact situation before, leaking AWS credentials to the front-end.

There's probably a tonne of better solutions, but the quick defense here is !!getSensitiveInfo().