Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Update ruby style to use 'fat arrow' hash syntax

  • Loading branch information...
commit 7b42ad53491eba6ae83e82f565ec06162ad34ed5 1 parent 1c8d424
@alext alext authored
Showing with 6 additions and 6 deletions.
  1. +6 −6 ruby.md
View
12 ruby.md
@@ -564,23 +564,23 @@
hash = {"one" => 1, "two" => 2, "three" => 3}
# good
- hash = {one: 1, two: 2, three: 3}
+ hash = {:one => 1, :two => 2, :three => 3}
```
-- Use Ruby 1.9 syntax for symbolic hash keys. This includes method calls.
+- Use fat arrows (a.k.a hashrocket) syntax for symbolic hash keys. This includes method calls.
```ruby
# bad
- hash = {:one => 1, :two => 2}
+ hash = {one: 1, two: 2}
# good
- hash = {one: 1, two: 2}
+ hash = {:one => 1, :two => 2}
# bad
- some_method :one => 1, :two => 2
+ some_method one: 1, two: 2
# good
- some_method one: 1, two: 2
+ some_method :one => 1, :two => 2
```
## Strings
Please sign in to comment.
Something went wrong with that request. Please try again.