Sha256: 668da5ce3a6aa3f496cdaa69d4e83f1e7f1e4952e6c1c6090a11ae7151f45e7e
Contents?: true
Size: 1.07 KB
Versions: 4
Compression:
Stored size: 1.07 KB
Contents
require File.join(File.dirname(__FILE__), 'base') module Mack module Rendering # :nodoc: module Type # :nodoc: # Used to render files stored in the public directory. These files are NOT run through any engines # and are returned 'as is'. class Public < Mack::Rendering::Type::Base # Attempts to find the file on disk and return it. If no file extension is provided then the 'format' # of the request is appended to the file name. def render p_file = self._render_value if File.extname(p_file).blank? p_file = "#{p_file}.#{self._options[:format]}" end Mack.search_path(:public).each do |path| find_file(File.join(path, p_file)) do |f| return File.open(f).read end end raise Mack::Errors::ResourceNotFound.new(p_file) end # No layouts should be used with this Mack::Rendering::Type def allow_layout? false end end # Public end # Type end # Rendering end # Mack
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
mack-0.8.1 | lib/mack/rendering/type/public.rb |
mack-0.8.2 | lib/mack/rendering/type/public.rb |
mack-0.8.3 | lib/mack/rendering/type/public.rb |
mack-0.8.3.1 | lib/mack/rendering/type/public.rb |