module PartiallyUseful::PartialRenderer

Public Instance Methods

render_partial(context, options, &block) click to toggle source
Calls superclass method
# File lib/partially_useful/partial_renderer.rb, line 3
def render_partial(context, options, &block)
  if html_context?(context)
    msg = "rendering '#{options[:partial]}' with locals '#{(options[:locals] || {}).keys}'"
    "<!-- start #{msg}-->\n#{super(context, options, &block)}\n<!-- end #{msg}-->\n".html_safe
  else
    super(context, options, &block)
  end
end

Private Instance Methods

html_context?(context) click to toggle source
# File lib/partially_useful/partial_renderer.rb, line 14
def html_context?(context)
  if context && context.request
    context.request.format.html?
  end
end