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


David

-- 
Q. What is THE Ruby book for Rails developers?
A. RUBY FOR RAILS by David A. Black (http://www.manning.com/black)
    (See what readers are saying!  http://www.rubypal.com/r4rrevs.pdf)
Q. Where can I get Ruby/Rails on-site training, consulting, coaching?
A. Ruby Power and Light, LLC (http://www.rubypal.com)