Module Ezamar
In: lib/ezamar/element.rb
lib/ezamar/render_partial.rb
lib/ezamar/engine.rb
lib/ezamar/version.rb
lib/ezamar/morpher.rb

This applies a morphing-replace for the template.

To use the functionality of Morpher you will need to have hpricot installed, you will get one error in case you don‘t and the method will be replaced by a stub that simply returns the template.

The method first checks if you use any morphers and just skips the step if you don‘t, this should give quite some speedup for smaller templates that don‘t use this functionality at all. the check works by searching the morphs with appended ’=’ in the template. There may be a few cases where this won‘t work since we cannot make any assumptions on the format.

If you want to turn this functionality off, either remove Morpher from:

  Ramaze::Template::Ezamar::TRANSFORM_PIPELINE

or do:

  Ramaze::Morpher::MORPHS.clear

The latter is a tad slower, but i mention the possibility in case you find good use for it.

You can add your own morphers in Ramaze::Morpher::MORPHS

For Example:

  Morpher::MORPHS['if'] = '<?r %morph %expression ?>%content<?r end ?>'

Now, assuming that some tag in your template is ’<a if="@foo">x</a>’

%morph stands for the name of your morph: ‘if’ %expression is the stuff you write in the attribute: ’@foo’ %content is the tag without the attribute (and all inside): ’<a>x</a>’

Classes and Modules

Module Ezamar::Morpher
Class Ezamar::Element
Class Ezamar::RenderPartial
Class Ezamar::Template

Constants

VERSION = "2009.06"

[Validate]