キーがシンボルでも文字列でもアクセスできるようにしてくれるっぽい。
HashWithIndifferentAccess.new(a: 1)['a']
=> 1
HashWithIndifferentAccess.new(a: 1)[:a]
=> 1
普通のハッシュじゃ無理なこと。
ActiveSupport::HashWithIndifferentAccess
チャットメンバー募集
何か質問、悩み事、相談などあればLINEオープンチャットもご利用ください。
Go to list of users who liked
Share on X(Twitter)
Share on Facebook
More than 1 year has passed since last update.
キーがシンボルでも文字列でもアクセスできるようにしてくれるっぽい。
HashWithIndifferentAccess.new(a: 1)['a']
=> 1
HashWithIndifferentAccess.new(a: 1)[:a]
=> 1
普通のハッシュじゃ無理なこと。
ActiveSupport::HashWithIndifferentAccess
何か質問、悩み事、相談などあればLINEオープンチャットもご利用ください。
Register as a new user and use Qiita more conveniently
Go to list of users who liked