Sha256: 4f6376290bc64c30333474d31d57f979e467ff1eaca53a5a77e4b38cebe1828c
Contents?: true
Size: 1.6 KB
Versions: 10
Compression:
Stored size: 1.6 KB
Contents
module Mack module Rendering # :nodoc: module Type # :nodoc: # Mack::Rendering::Type objects need to extend this class. # # The method 'render' needs to be implemented as in all subclasses. class Base # Returns the Mack::Rendering::ViewTemplate object associated with this render. attr_reader :view_template def initialize(view_template) @view_template = view_template end needs_method :render # If a file is found on disk it will be yielded up. # # Example: # find_file("path", "to", "my", "file") do |f| # puts File.open(f).read # end def find_file(*path) f = File.join(path) if File.exists?(f) yield f end end # Can be overridden by subclasses to prevent layouts being used with the render. def allow_layout? true end def find_engine(e) eval("Mack::Rendering::Engine::#{e.to_s.camelcase}") end def method_missing(sym, *args) self.view_template.send(sym, *args) end # See Mack::Rendering::ViewTemplate content_for for more details. def capture(*args, &block) @engine.capture(*args, &block) end # Returns the directory path for the current controller. def controller_view_path ivar_cache do Mack::Paths.views(self.controller.controller_name) end end end end end end
Version data entries
10 entries across 10 versions & 1 rubygems