lib/roda/plugins/render.rb
# Given the template name and options, set the template class, template path/content,
# template block, and locals to use for the render in the passed options.
Given the template name and options, set the template class, template path/content,
template block, and locals to use for the render in the passed options.
Given the template name and options set the template class template path / content template block and locals to use for the render in the passed options .
def find_template(opts)
          render_opts = render_opts()
          engine_override = opts[:engine]
          engine = opts[:engine] ||= render_opts[:engine]
          if content = opts[:inline]
            path = opts[:path] = content
            template_class = opts[:template_class] ||= ::Tilt[engine]
            opts[:template_block] = Proc.new{content}
          else
            opts[:views] ||= render_opts[:views]
            path = opts[:path] ||= template_path(opts)
            template_class = opts[:template_class]
            opts[:template_class] ||= ::Tilt
          end
          if (cache = opts[:cache]).nil?
            cache = content || !opts[:template_block]
          end
          if cache
            template_block = opts[:template_block] unless content
            template_opts = opts[:template_opts]
            opts[:cache_key] ||= if template_class || engine_override || template_opts || template_block
              [path, template_class, engine_override, template_opts, template_block]
            else
              path
            end
          else
            opts.delete(:cache_key)
          end
          opts
        end
def find_template ( opts ) render_opts = render_opts ( ) engine_override = opts [ :engine ] engine = opts [ :engine ] ||= render_opts [ :engine ] if content = opts [ :inline ] path = opts [ :path ] = content template_class = opts [ :template_class ] ||= :: Tilt [ engine ] opts [ :template_block ] = Proc . new { content } else opts [ :views ] ||= render_opts [ :views ] path = opts [ :path ] ||= template_path ( opts ) template_class = opts [ :template_class ] opts [ :template_class ] ||= :: Tilt end if ( cache = opts [ :cache ] ) . nil? cache = content || ! opts [ :template_block ] end if cache template_block = opts [ :template_block ] unless content template_opts = opts [ :template_opts ] opts [ :cache_key ] ||= if template_class || engine_override || template_opts || template_block [ path , template_class , engine_override , template_opts , template_block ] else path end else opts . delete ( :cache_key ) end opts end
Given the template name and options, set the template class, template path/content,
template block, and locals to use for the render in the passed options.
Given the template name and options set the template class template path / content template block and locals to use for the render in the passed options .
opts
<not_specific>