class PartialLogging::PartialRendererWithLogging

Public Instance Methods

formatted_partial_identifier(identifier) click to toggle source
# File lib/partial_logging/partial_renderer_with_logging.rb, line 21
def formatted_partial_identifier(identifier)
  if PartialLogging.config.absolute_path?
    identifier
  else
    identifier.sub(/#{Rails.root.to_s}/, '(app root)')
  end
end
render(context, options, block) click to toggle source

@return [ActionView::OutputBuffer]

Calls superclass method
# 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 #{formatted_partial_identifier(identifier)} -->
      #{content}
    <!-- END #{formatted_partial_identifier(identifier)} -->
    """
    content = output_buffer
  end
  content
end