On 5/22/07, dblack / wobblini.net <dblack / wobblini.net> wrote: > Hi -- > > On Tue, 22 May 2007, Brad Phelan wrote: > > > In general I think that above is not a good idea for Ruby. However it does > > look good when dealing with libraries like Markaby where the number of > > closing ends starts to look very scary From some of my own templates > > > > > > table do > > @components.each do |row| > > tr do > > row.each do |col| > > td do > > pre do > > text col > > end > > end > > end > > end > > end > > end > > end > > > > whereas it could look like > > > > > > table do : > > @components.each do |row| : > > tr do > > row.each do |col| : > > td do : > > pre do : > > text col > > > > > > > > which gives it a feel like a YAML file. > > I prefer Ruby files that feel like Ruby files (why is everyone so > concerned with trying to figure what, other than Ruby, Ruby should > look like?), but meanwhile if you use standard indentation (and get > rid of the extraneous end in your example :-) it looks a lot nicer to > start with: > > table do > @components.each do |row| > tr do > row.each do |col| > td do > pre do > text col > end > end > end > end > end > end And with the judicious use of {} vs. do end there are other alternatives which may suit individual tastes depending on how tightly you like to see the code: table do @components.each do |row| tr do row.each do |col| td {pre {text col} end end end end or the ultra tight: table {@components.each {|row| tr {row.each {|col| td {pre {text col}}}}} or if you aren't religious about reserving brackets for one-line blocks (I'm not): table { @components.each { |row| tr { row.each { |col| td {pre {text col} } } } } Or anywhere in-between. -- Rick DeNatale My blog on Ruby http://talklikeaduck.denhaven2.com/