Some of my pet peeves of center around arrays. Ruby provides a really rich language around arrays, use it to make your code more readable.

Ask an array if it's empty. Don't check if it has a size equal to zero.

bookmarks.size == 0 # no!
bookmarks.empty? # yes

Ask an array it it has any elements. Don't check if it has a non-zero size.

bookmarks.size > 0 # no!
bookmarks.any? # yes

You don't need to ask if an array has elements before iterating over it using each, each will not yield unless the array has elements.

if bookmarks.any?; bookmarks.each { ... }; end # pointless
bookmarks.each { ... } # does the same thing
I'm sure you have other similar peeves. Let me know what they are in the comments.
written by
Disagree? Found a typo? Got a question?
If you'd like to have a conversation about this post, email I don't bite.
You can verify that I've written this post by following the verification instructions:
curl -LO
curl -LO
gpg --verify be-cool-with-arrays.html.orig{.asc,}