How to do pythonic list comprehensions with conditions in ruby?