Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Initializers of Array, Hash and Set #89

Closed
SirLenz0rlot opened this Issue · 1 comment

2 participants

@SirLenz0rlot

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?

@bbatsov
Owner

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 referenced this issue from a commit in amiel/ruby-style-guide
@bbatsov fixed #89 - favor the use of array and hash literals for their creation d6e592e
@JuanitoFatas JuanitoFatas referenced this issue from a commit in JuanitoFatas/ruby-style-guide
@JuanitoFatas JuanitoFatas update chinese version of #66, #89, exception, array&hash, extra quot…
…e...
65510ee
@bbatsov bbatsov closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.