benjaminwil.info

Semantic style Ruby blocks (opens in new tab)

Here’s another blog post vouching for writing Ruby blocks using the semantic rule. Sometimes called “the Weirich rule” because of Jim Weirich’s “Braces vs. Do/End” article1 and an issue he filed against rubocop/ruby-style-guide. The rule unambiguously answers the question posed by Weirich: “When should you use {} for blocks and when should you use do/end?” His answer:

Read the original article
Sign in to keep reading the full article.

Keyboard Shortcuts

Navigation

Next / previous post
j/k
Open post
oorEnter
Preview post
v

Post Actions

Love post
a
Like post
l
Dislike post
d
Undo reaction
u
Save / unsave
s

Recommendations

Add interest / feed
Enter
Not interested
x

Go to

Home
gh
Interests
gi
Feeds
gf
Likes
gl
History
gy
Changelog
gc
Settings
gs
Discover
gb
Search
/

General

Show this help
?
Submit feedback
!
Close modal / unfocus
Esc

Press ? anytime to show this help