On Jul 20, 2005, at 4:40 PM, Brian Takita wrote:

> But now that I think about it, something like this would work out
> better:
>
> <%=
> begin
>     out = '<p'
>     out << ' style="text-align: center"' if @has_style
>     out << '...' if @show_another_attribute
>     out << '>'
>     out << Paragraph
>     out << '</p>
> end
> %>

This looks like a prime candidate for refactoring into a helper,  
actually:

   <p<%= my_custom_p_attrs %>>Paragraph</p>

With the corresponding helper definition:

   def my_custom_p_attrs
     attrs = ""
     attrs << %{ style="text-align: center"} if @has_style
     attrs << %{ ...} if @show_another_attribute
     attrs
   end

- Jamis