Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Initializers of Array, Hash and Set #89

Closed
lenntt opened this Issue Mar 26, 2012 · 1 comment

Comments

Projects
None yet
2 participants

lenntt commented Mar 26, 2012

Hi,

I miss some rules on the initializers of Arrays and Hashes. I prefer to use
{} and [] over Hash.new and Array.new.

Sets are a bit more difficult, I myself use Set.new, when an array is empty but otherwise [foo, bar].to_set.

Another notation of this would be Set[foo, bar], but i prefer the other.

Any comments?

Owner

bbatsov commented Mar 27, 2012

I totally agree. It's not included in the guide, since I doubted anyone would create an empty array or hash without the literal syntax.

@amiel amiel pushed a commit to amiel/ruby-style-guide that referenced this issue Apr 20, 2012

@bbatsov bbatsov fixed #89 - favor the use of array and hash literals for their creation d6e592e

@JuanitoFatas JuanitoFatas added a commit to JuanitoFatas/ruby-style-guide that referenced this issue Apr 25, 2012

@JuanitoFatas JuanitoFatas update chinese version of #66, #89, exception, array&hash, extra quot…
…e...
65510ee

@bbatsov bbatsov closed this May 5, 2012

@marocchino marocchino pushed a commit to marocchino/ruby-style-guide that referenced this issue Aug 11, 2015

@bbatsov bbatsov fixed #89 - favor the use of array and hash literals for their creation 6a9ae71

@shyouhei shyouhei pushed a commit to shyouhei/ruby-style-guide that referenced this issue Nov 11, 2015

@bbatsov bbatsov fixed #89 - favor the use of array and hash literals for their creation 45a8c5d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment