Class Mack::Rendering::Type::FileBase
In: lib/mack/rendering/type/file_base.rb
Parent: Mack::Rendering::Type::Base

Methods

Public Instance methods

Passes concatenation messages through to the Mack::Rendering::Engine object. This should append the text, using the passed in binding, to the final output of the render.

[Source]

    # File lib/mack/rendering/type/file_base.rb, line 29
29:         def concat(txt, b)
30:           @engine.concat(txt, b)
31:         end

Returns a string representing the file stored on disk, once it‘s be run through the first found Mack::Rendering::Engine object associated with this Mack::Rendering::Type.

Since engines are stored in an array, the are looped through until a template is found on disk. If no template is found then a Mack::Errors::ResourceNotFound exception is thrown.

[Source]

    # File lib/mack/rendering/type/file_base.rb, line 12
12:         def render_file(file, type = :action)
13:           # we want to look local first, hence the reverse
14:           Mack.search_path_local_first(:app).each do |path|
15:             tfile = file.gsub(Mack::Paths.app, path)
16:             Mack::Rendering::Engine::Registry.engines[type].each do |e|
17:               @engine = find_engine(e).new(self.view_template)
18:               find_file(tfile + ".#{@engine.extension}") do |f|
19:                 return @engine.render(File.new(f), self._binder)
20:               end
21:             end
22:           end
23:           raise Mack::Errors::ResourceNotFound.new(file + ".*")
24:         end

[Validate]