Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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

  • Loading branch information...
commit d6e592e5a7f0f069be985c0ba449b0bfae87573f 1 parent 919473f
@bbatsov bbatsov authored
Showing with 13 additions and 0 deletions.
  1. +13 −0 README.md
View
13 README.md
@@ -1022,6 +1022,19 @@ introducing new exception classes.
## Collections
+* Prefer literal array and hash creation notation (unless you need to
+pass parameters to their constructors, that is).
+
+ ```Ruby
+ # bad
+ arr = Array.new
+ hash = Hash.new
+
+ # good
+ arr = []
+ hash = {}
+ ```
+
* Prefer `%w` to the literal array syntax when you need an array of
strings.
Please sign in to comment.
Something went wrong with that request. Please try again.