2017.03.27 Rubyスタイルガイドを読む: コレクション(Array、Hash、Setなど) 参照: bbatsov/ruby-style-guide 7-01【統一】配列やハッシュの作成は[]や{}によるリテラル表記が望ましい Prefer literal array and hash creation notation (unless you need to pass parameters to their constructors, that is). Array#newやHash.newによる作成は、コンストラクタにパラメータを渡す必要がある場合のみとします。タイプ量が少ないという点も含めて、リテラル表記に揃えるスタイルにしたということですね。 # 不可 arr = Array.new hash = Hash.new # 良好 arr = [] hash = {} 7-0
![Rubyスタイルガイドを読む: コレクション(Array、Hash、Setなど)|TechRacho by BPS株式会社](https://cdn-ak-scissors.b.st-hatena.com/image/square/f31380ec243f3616f6df19ec1e281a3751560f48/height=288;version=1;width=512/https%3A%2F%2Ftechracho.bpsinc.jp%2Fwp-content%2Fuploads%2F2017%2F03%2F170327_1740_DXekd5.png)