[LRUG] Concat and Strings
Damian Janowski
damian.janowski at gmail.com
Tue May 13 07:13:02 PDT 2008
On Tue, May 13, 2008 at 5:23 AM, Andrew Stewart
<boss at airbladesoftware.com> wrote:
> Hi El Rug,
>
> I can't quite explain the behaviour I'm seeing below. I'd value any
> explanation.
>
> So...I have a wrap method in a Rails view helper (fragmented for
> debugging):
>
> def wrap(with, &block)
> inner = capture &block
> s = "#{with} { #{inner} }"
> concat s, block.binding
> end
I don't see any reason for the behaviour you're describing, and a
quick irb session shows that your syntax is good...
Maybe post the full code?
BTW, you may want to avoid calling capture as much as possible:
def wrap(with, &block)
concat("#{with} {", block.binding)
yield
concat("}", block.binding)
end
More information about the Chat
mailing list