ある配列の文字列を別の文字列と連結する方法を(ドキュメントで)読みました。
a = [ "a", "b", "c", "d" ]
a.collect! {|x| x + "!" }
a #=> [ "a!", "b!", "c!", "d!" ]
しかし、私が理解していないのは、2つの配列の文字列を1つに連結する方法です。例えば:
field_suffix = %w[prev curr]
field_names = %w[_first_name _last_name]
私が見たいのはこれです:
["prev_first_name", "curr_first_name", "prev_last_name", "curr_last_name"]
順序は関係ありません。かもしれない:
["prev_first_name", "prev_last_name", "curr_first_name", "curr_last_name"]