2020-06-23から1日間の記事一覧
with_indexをmapにつなげて書けばよいようだ array = ['apple', 'peach', 'orange'] p array.map.with_index{|v, index| index > 1 ? 'hoge' : v} => ["apple", "peach", "hoge"]
with_indexをmapにつなげて書けばよいようだ array = ['apple', 'peach', 'orange'] p array.map.with_index{|v, index| index > 1 ? 'hoge' : v} => ["apple", "peach", "hoge"]