Sometimes I find it useful to define a little helper proc within a haml view in a rails app, but the syntax I've come up with is pretty horrible. I'm wondering if there is a good way to do this. Here's an example:
- strong_name = lambda do |object| capture do - 2.times do %strong= object.name - end end = strong_name.call(object) So I have a few questions 1) Is there a terser/better way to say this? 2) Why can't I use curly braces in place of either do/end? 3) Assume that there is no good answer to #1, would there be value in a helper method that combines this into some sort of 'capture_proc' function that does the capture and the lamda together so you could write: - strong_name = capture_proc do |object| - 2.times do %strong= object.name I hope this is the right forum for this sort of question; if it's not, I'd welcome any suggestions about where to post this. Thanks for your help, Andrew -- You received this message because you are subscribed to the Google Groups "Haml" group. To unsubscribe from this group and stop receiving emails from it, send an email to haml+unsubscr...@googlegroups.com. To post to this group, send email to haml@googlegroups.com. Visit this group at http://groups.google.com/group/haml. For more options, visit https://groups.google.com/d/optout.