20140122

The ruby hint of the day: Hash#fetch

Use hash.fetch(key) instead of hash[key] whenever your Hash is constant and you expect the key to be one of the hash keys — it will raise an exception if not found. Early bug detection you see.

No comments:

Post a Comment