Class: Nagoro::Pipe::RenderPartial

Inherits:
Base
  • Object
show all
Includes:
Innate::Helper::Render
Defined in:
lib/ramaze/view/nagoro/render_partial.rb

Overview

Pipe that transforms <render /> tags.

the src parameter in the render tag will be used as first parameter to render_partial, all other parameters are passed on as variables.

Example calling render_partial(‘hello’):

<render src="hello" />

Example calling render_partial(‘hello’, ‘tail’ => ‘foo’):

<render src="hello" tail="foo" />

Instance Method Summary collapse

Instance Method Details

#tag_end(tag) ⇒ Object



27
28
29
# File 'lib/ramaze/view/nagoro/render_partial.rb', line 27

def tag_end(tag)
  super unless tag == 'render'
end

#tag_start(tag, attrs) ⇒ Object



19
20
21
22
23
24
25
# File 'lib/ramaze/view/nagoro/render_partial.rb', line 19

def tag_start(tag, attrs)
  if tag == 'render' and action_name = attrs.delete('src')
    append(render_partial(action_name, attrs))
  else
    super
  end
end