Ruby 2.7.0 リファレンスマニュアル > ライブラリ一覧 > matrixライブラリ > Matrixクラス > square?
square? -> bool
正方行列であるなら、 true を返します。