Module: Devel::ActionController::ViewRenderer

Defined in:
lib/devel/action_controller/view_renderer.rb

Instance Method Summary collapse

Instance Method Details

#render(options = {}, locals = {}, &block) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/devel/action_controller/view_renderer.rb', line 4

def render(options = {}, locals = {}, &block)
  output = ''.html_safe
  case options
  when Hash
    if block_given?
      output << "\n<!-- BEGIN: #{options[:partial]} -->\n".html_safe
      output << view_renderer.render_partial(self, options.merge(:partial => options[:layout]), &block)
      output << "\n<!-- END: #{options[:partial]} -->".html_safe
    else
      output << "\n<!-- BEGIN: #{options[:partial]} -->\n".html_safe
      output << view_renderer.render(self, options)
      output << "\n<!-- END: #{options[:partial]} -->".html_safe
    end
  else
    output << "\n<!-- BEGIN: #{options} -->\n".html_safe
    output << view_renderer.render_partial(self, :partial => options, :locals => locals)
    output << "\n<!-- END: #{options} -->".html_safe
  end
  output
end