lib/roda/plugins/precompile_templates.rb
# Precompile the given views with the given locals, handling optimized template methods.
Precompile the given views with the given locals, handling optimized template methods.
Precompile the given views with the given locals handling optimized template methods .
def precompile_views(views, locals=EMPTY_ARRAY)
          instance = allocate
          views = Array(views)
          if locals.empty?
            opts = OPTS
          else
            locals_hash = {}
            locals.each{|k| locals_hash[k] = nil}
            opts = {:locals=>locals_hash}
          end
          views.each do |view|
            instance.send(:retrieve_template, instance.send(:render_template_opts, view, opts))
          end
          if locals_hash
            views.each do |view|
              instance.send(:_optimized_render_method_for_locals, view, locals_hash)
            end
          end
          nil
        end
def precompile_views ( views , locals = EMPTY_ARRAY ) instance = allocate views = Array ( views ) if locals . empty? opts = OPTS else locals_hash = { } locals . each { | k | locals_hash [ k ] = nil } opts = { :locals => locals_hash } end views . each do | view | instance . send ( :retrieve_template , instance . send ( :render_template_opts , view , opts ) ) end if locals_hash views . each do | view | instance . send ( :_optimized_render_method_for_locals , view , locals_hash ) end end nil end
Precompile the given views with the given locals, handling optimized template methods.
Precompile the given views with the given locals handling optimized template methods .
views
locals