From: Marnen Laibow-Koser Date: 2010-01-10T11:34:49+09:00 Subject: Re: Ruby editing style rules and recommendation? Josh Cheek wrote: > On Sat, Jan 9, 2010 at 2:01 PM, Nathan Oyama wrote: > >> Which one is recommended in terms of the editing style? >> > > I usually use braces for single line, and do/end for multi-line. That's what 99% of Ruby programmers do. :) > > I've also started alternating them to make it clearer where blocks start > and > end. > > def whatever > each { |obj| > if obj < MID > call_method > else > self.var = yield obj > call_other_method > end > } > end Yuck! That looks inconsistent to me. It would also be an editing nightmare if you extract or introduce one level of nesting. > > def whatever > each do |obj| > if obj < MID > call_method > else > self.var = yield obj > call_other_method > end > end > end > > I think the top one is much easier to read, so I sometimes alternate > now. Best, --  Marnen Laibow-Koser http://www.marnen.org marnen@marnen.org -- Posted via http://www.ruby-forum.com/.