Sha256: c124a573234759606e20f809a24cb238b51327c75219274d24e7ce29815ff3a9

Contents?: true

Size: 1020 Bytes

Versions: 2

Compression:

Stored size: 1020 Bytes

Contents

require File.join(File.dirname(__FILE__), 'file_base')
module Mack
  module Rendering # :nodoc:
    module Type # :nodoc:
      # Used to render layouts around views.
      class Layout < Mack::Rendering::Type::FileBase
        
        # See Mack::Rendering::Type::FileBase render_file for more information.
        # 
        # The path to the file is built like such:
        #   app/views/layouts/#{options[:layout] || "application"}.#{format (html, xml, js, etc...)}.#{extension defined in the engine}
        # Example:
        #   app/views/layouts/application.html.erb 
        def render
          l_file = File.join(Mack::Configuration.views_directory, 'layouts', "#{self.options[:layout]}.#{self.options[:format]}")
          begin
            render_file(l_file, :layout)
          rescue Mack::Errors::ResourceNotFound => e
            MACK_DEFAULT_LOGGER.warn(e)
            self.view_template.yield_to :view
          end
        end
        
      end # Layout
    end # Type
  end # Rendering
end # Mack

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mack-0.5.5.3 lib/rendering/type/layout.rb
mack-0.5.5.4 lib/rendering/type/layout.rb