module Roda::RodaPlugins::RenderLocals::InstanceMethods

def view_layout_opts(opts)

If using a layout, then use the plugin's layout locals as the default locals.
def view_layout_opts(opts)
  if layout_opts = super
    merge_locals = layout_opts.has_key?(:merge_locals) ? layout_opts[:merge_locals] : self.opts[:merge_locals] 
    locals = {}
    locals.merge!(layout_locals)
    if merge_locals && (method_locals = opts[:locals])
      locals.merge!(method_locals)
    end
    if method_layout_locals = layout_opts[:locals]
      locals.merge!(method_layout_locals)
    end
    layout_opts[:locals] = locals
    layout_opts
  end
end