Browse files

Suggest a more permissive use of string quoting.

  • Loading branch information...
1 parent ea25574 commit 305d096cf1970f136af47a5b7a7afbcc400a37fe @fatbusinessman fatbusinessman committed Feb 14, 2013
Showing with 4 additions and 12 deletions.
  1. +4 −12 ruby.md
View
16 ruby.md
@@ -603,18 +603,10 @@
email_with_name = "#{user.name} <#{user.email}>"
```
-- Use double-quoted strings. Most files will need some double-quoted strings,
- so it’s more consistent. Interpolation is in any case easy to see thanks
- to syntax highlighting, and there is no speed advantage to using single
- quotes.
-
- ```ruby
- # bad
- name = 'Bozhidar'
-
- # good
- name = "Bozhidar"
- ```
+- Try not to mix up single-quoted and double-quoted strings within a file:
+ it can make the code harder to read. *Definitely* don't mix up single-quoted
+ and double-quoted strings within a method. If in doubt, use double-quoted
+ strings.
- Avoid using `String#+` when you need to construct large data chunks.
Instead, use `String#<<`. Concatenation mutates the string instance

0 comments on commit 305d096

Please sign in to comment.