Hey,

in ERB it was possible to use tap to not repeat some calculations, e.g.:

<% Model.some_complex_query.tap do |result| %>
  <%= something if result.size > 0 %>
  <% result.each {} %>
<% end %>

and so on...

When I try similar thing it in Haml it displays the value of the tapped 
object after executing the block.

- "string".tap do |s|
  -# nothing here

will display "string", because it simply executes the code and #tap returns 
the original object after executing the block. Is there a way to get similar 
behavior as in ERB?

Cheers,
Szymon

-- 
You received this message because you are subscribed to the Google Groups 
"Haml" group.
To post to this group, send email to haml@googlegroups.com.
To unsubscribe from this group, send email to haml+unsubscr...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/haml?hl=en.

Reply via email to