概要
二次元配列の各要素全てが空かどうか検証する
詳細
tbpgr_utils gemのArray#together_empty?。(別名でtempty?もあり)
二次元配列の各要素全てが空かどうか検証します。
事前準備
gem install tbpgr_utils
主な用途
二次元配列の各要素全てが空かどうか知りたい場合。
サンプルコード
# encoding: utf-8 require 'tbpgr_utils' bulk_puts_eval binding, <<-EOS [[:a], []].together_empty? [[], []].together_empty? [[:a], []].tempty? [[], []].tempty? EOS __END__ 下記はTbpgrUtils gemの機能 bulk_puts_eval https://rubygems.org/gems/tbpgr_utils https://github.com/tbpgr/tbpgr_utils
出力
[[:a], []].together_empty? # => false [[], []].together_empty? # => true [[:a], []].tempty? # => false [[], []].tempty? # => true