I'm not an expert on this by any means, but something along these lines should work:
def helper(a, b, &block) yld = capture(&block) out = ...build up string using a, b, and yld... concat out, block.binding end
Use "<% helper", not "<%= helper" when you call it (no equal sign)
HTH