概要
二つ以上の配列の任意のインデックスの値を配列として取得する
詳細
tbpgr_utils gemのArray#together_at
二つ以上の配列の任意のインデックスの値を配列として取得します。
事前準備
gem install tbpgr_utils
主な用途
二つ以上の配列の任意のインデックスの値を取得したい時。
サンプルコード
# encoding: utf-8 require 'tbpgr_utils' require 'test_toolbox' j = %w{月 火 水 木 金 土 日} el = %w{Monday Tuesday Wednesday Thursday Friday Saturday Sunday} es = %w{Mon Tues Wed Thurs Fri Sat Sun} list = [j, el, es] puts [j, el, es].together_at 2 dp_line __LINE__ puts [j, el, es].together_at 5 __END__ 下記はTbpgrUtils gemの機能 dp_line https://rubygems.org/gems/tbpgr_utils https://github.com/tbpgr/tbpgr_utils
出力
水 Wednesday Wed --------------------|filename=|line=11|-------------------- 土 Saturday Sat