# Pastebin QQJ6Y0Dm input = [ ["", "foo", "bar"], ["", "baz", "qux"] ] filtered = Array.new input.map { |im| filtered << im.reject(&:empty?) }