aboutsummaryrefslogblamecommitdiffstats
path: root/actionpack/test/lib/fixture_template.rb
blob: 26f6ec2d0c8ff4f7f3bf0c86d421cda9b38b9b99 (plain) (tree)


































                                                                                      
module ActionView #:nodoc:
  class FixtureTemplate < Template
    class FixturePath < Template::Path
      def initialize(hash = {})
        @hash = {}
        
        hash.each do |k, v|
          @hash[k.sub(/\.\w+$/, '')] = FixtureTemplate.new(v, k.split("/").last, self)
        end
        
        super("fixtures://root")
      end
      
      def find_template(path)
        @hash[path]
      end
    end
    
    def initialize(body, *args)
      @body = body
      super(*args)
    end
    
    def source
      @body
    end
  
  private
  
    def find_full_path(path, load_paths)
      return '/', path
    end
  
  end
end