Class Index [+]

Quicksearch

Merb::BootLoader::Templates

Precompiles all non-partial templates.

Public Class Methods

run() click to toggle source

Loads all non-partial templates into the Merb::InlineTemplates module.

Returns

Array[String]

The list of template files which were loaded.

:api: plugin

      # File lib/merb-core/bootloader.rb, line 1128
1128:     def run
1129:       template_paths.each do |path|
1130:         Merb::Template.inline_template(File.open(path))
1131:       end
1132:     end
template_paths() click to toggle source

Finds a list of templates to load.

Returns

Array[String]

All found template files whose basename does not begin with “_”.

:api: private

      # File lib/merb-core/bootloader.rb, line 1140
1140:     def template_paths
1141:       extension_glob = "{#{Merb::Template.template_extensions.join(',')}}"
1142: 
1143:       # This gets all templates set in the controllers template roots
1144:       # We separate the two maps because most of controllers will have
1145:       # the same _template_root, so it's silly to be globbing the same
1146:       # path over and over.
1147:       controller_view_paths = []
1148:       Merb::AbstractController._abstract_subclasses.each do |klass|
1149:         next if (const = Object.full_const_get(klass))._template_root.blank?
1150:         controller_view_paths += const._template_roots.map { |pair| pair.first }
1151:       end
1152:       template_paths = controller_view_paths.uniq.compact.map { |path| Dir["#{path}/**/*.#{extension_glob}"] }
1153: 
1154:       # This gets the templates that might be created outside controllers
1155:       # template roots.  eg app/views/shared/*
1156:       template_paths << Dir["#{Merb.dir_for(:view)}/**/*.#{extension_glob}"] if Merb.dir_for(:view)
1157: 
1158:       # This ignores templates for partials, which need to be compiled at use time to generate
1159:       # a preamble that assigns local variables
1160:       template_paths.flatten.compact.uniq.grep(%{^.*/[^_][^/]*$})
1161:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.