Class: PartialLogging::PartialRendererWithLogging

Inherits:
ActionView::PartialRenderer
  • Object
show all
Defined in:
lib/partial_logging/partial_renderer_with_logging.rb

Instance Method Summary collapse

Instance Method Details

#render(context, options, block) ⇒ ActionView::OutputBuffer

Returns:

  • (ActionView::OutputBuffer)


6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/partial_logging/partial_renderer_with_logging.rb', line 6

def render(context, options, block)
  content = super(context, options, block)
  identifier = @template ? @template.identifier : @path
  if @lookup_context.rendered_format == :html
    output_buffer = ActionView::OutputBuffer.new
    output_buffer.safe_concat """
    <!-- START #{identifier} -->
      #{content}
    <!-- END #{identifier} -->
    """
    content = output_buffer
  end
  content
end