Class: Ezamar::RenderPartial

Inherits:
Object
  • Object
show all
Extended by:
Ramaze::Helper::Partial
Defined in:
lib/ramaze/template/ezamar/render_partial.rb

Overview

A transformer for <render /> tags.

Class Method Summary collapse

Methods included from Ramaze::Helper::Partial

render_action, render_partial, render_template

Class Method Details

.transform(template) ⇒ Object

Renders <render src=“/path” [optional=“option”, …]> in place.

Other options than ‘src` will be transformed to session parameters for the rendered action to use.



19
20
21
22
23
24
25
26
27
28
# File 'lib/ramaze/template/ezamar/render_partial.rb', line 19

def self.transform(template)
  template.gsub!(/<render (.*?) \/>/) do |m|
    args = Hash[*$1.scan(/(\S+)=["'](.*?)["']/).flatten]
    if src = args.delete('src')
      render_partial(src, args)
    end
  end

  template
end