add ruby solution for matrix traversal