Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
ハッシュがありますPAYMENT_TYPES_HASH。eachのように配列を宣言せずに、このハッシュから配列を作成する方法はありa = []ますか?
PAYMENT_TYPES_HASH
each
a = []
a = []; PAYMENT_TYPES_HASH.each {|order| a << [order[:name], order[:id]]} a
このようなもの:
array = PAYMENT_TYPES_HASH.each {|order| do something to return the array}
メソッドを使用する必要があります#map:
#map
PAYMENT_TYPES_HASH.map {|order| [order[:name], order[:id]]}