Plugins - ErbBuffer

StarAdd to favorites

Collecting ERB's output isn't supposed to be done, since it operates differently that a typical 'template' engine. Through a very simple view stack, this plugin will let you collect chunks of ERB in your templates for use later. It will also let you have deeply nested templates.

Michael Cerna

http://www.ahgsoftware.com/pages/erb_buffer

svn://ahgsoftware.com/erb_buffer/trunk

OpenSource

  • Currently 3.0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

View Extensions

Tags

Comments

Add a comment
Mike C. 15 Jan 2007

I mention it in my blog, but I felt the same way. The only issue I had with it, at first, is that 'capture' introduces many scoping problems that confound the average user (including myself). Also, I couldn't code or find a solution that allowed deep-nesting of captures.
Re: ugly syntax, I certainly value your opinion, but, the next step to make it 'Railsy' would be to make a one-size-fits-all solution for the scope-binding, which would just make the usage look like..

@contents = start_buffering do stuff end

to allow a proper closure, but, as for the implementation code, its utilizes a stack, and Ruby makes working with a stack as easy as 3 lines. Using the builtin string methods makes the nesting process rather small an elegant but not quite perl one-linerish, If you have a better way, I'd love to implement it and give you credit, since people are downloading it like crazy for some reason!

Maxim Kulkin 15 Jan 2007

Agreed. I had the very same feeling: 'capture' would do the trick. Also, the syntax looks quite ugly and unRails-ish.

Scott Fleckenstein 14 Jan 2007

Maybe i'm missing something, can't this be accomplished easier with 'capture'?

Search Plugins

Query syntax

Plugins by Category

Sponsors

Rails Kits: Get Code. Get Moving.

Have a comment?