Ruby 1.9.3 リファレンスマニュアル > ライブラリ一覧 > setライブラリ > Setクラス > collect!

instance method Set#collect!

collect! {|o| ...} -> self
map! {|o| ...} -> self

集合の各要素についてブロックを評価し、その結果で元の集合を置き換えます。

set = Set['hello', 'world']
set.map! {|str| str.capitalize}
p set  #=> #<Set: {"Hello", "World"}>

[SEE_ALSO] Enumerable#collect

class Set