LoginSignup
0
0

More than 1 year has passed since last update.

#Ruby の tap で ネストされたハッシュのキーを削除しつつ返り値で変更後の値を受け取る

Last updated at Posted at 2020-03-21

hash[:foo][:bar] のキーを削除したい

{foo: {bar: 1, yah: 2} }.tap { |h| h[:foo].delete(:bar) }
# => {:foo=>{:yah=>2}}

Original by Github issue

チャットメンバー募集

何か質問、悩み事、相談などあればLINEオープンチャットもご利用ください。

Twitter

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0