Class: Merb::BootLoader::Templates
- Inherits:
-
Merb::BootLoader
- Object
- Merb::BootLoader
- Merb::BootLoader::Templates
- Defined in:
- lib/merb-core/bootloader.rb
Class Method Summary collapse
-
.run ⇒ Object
Loads the templates into the Merb::InlineTemplates module.
-
.template_paths ⇒ Object
Returns Array:: Template files found.
Methods inherited from Merb::BootLoader
after, after_app_loads, before, before_app_loads, default_framework, finished?, inherited, move_klass
Class Method Details
.run ⇒ Object
Loads the templates into the Merb::InlineTemplates module.
674 675 676 677 678 |
# File 'lib/merb-core/bootloader.rb', line 674 def run template_paths.each do |path| Merb::Template.inline_template(File.open(path)) end end |
.template_paths ⇒ Object
Returns
- Array
-
Template files found.
682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 |
# File 'lib/merb-core/bootloader.rb', line 682 def template_paths extension_glob = "{#{Merb::Template.template_extensions.join(',')}}" # This gets all templates set in the controllers template roots # We separate the two maps because most of controllers will have # the same _template_root, so it's silly to be globbing the same # path over and over. controller_view_paths = [] Merb::AbstractController._abstract_subclasses.each do |klass| next if (const = Object.full_const_get(klass))._template_root.blank? controller_view_paths += const._template_roots.map { |pair| pair.first } end template_paths = controller_view_paths.uniq.compact.map { |path| Dir["#{path}/**/*.#{extension_glob}"] } # This gets the templates that might be created outside controllers # template roots. eg app/views/shared/* template_paths << Dir["#{Merb.dir_for(:view)}/**/*.#{extension_glob}"] if Merb.dir_for(:view) template_paths.flatten.compact.uniq end |