Show
Ignore:
Timestamp:
11/13/07 16:32:11 (1 year ago)
Author:
wyca..@gmail.com
Message:

New benchmarkers for Rails and Merb

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • apps/moved_to_rubyforge/merki/trunk/framework/merb/template/erubis.rb

    r939 r992  
    44    class ErubisViewContext < ViewContext 
    55      include ::Merb::ErubisCaptureMixin 
     6       
     7      public 
     8      def partial(template, opts={}) 
     9 
     10        puts 
     11        puts 
     12        puts "Inside new partial" 
     13        puts 
     14        puts 
     15 
     16        unless @_template_format 
     17          @web_controller.choose_template_format(Merb.available_mime_types, {}) 
     18        end 
     19 
     20        template = @web_controller._cached_partials["#{template}.#{@_template_format}"] ||= 
     21          @web_controller.send(:find_partial, template) 
     22 
     23        if with = opts.delete(:with) 
     24          as = opts.delete(:as) || template.match(/(.*\/_)([^\.]*)/)[2] 
     25          @_merb_partial_locals = opts         
     26          sent_template = [with].flatten.map do |temp| 
     27            @_merb_partial_locals[as.to_sym] = temp 
     28            send(template.gsub("/", "__").gsub(".", "_")) rescue "" 
     29          end.join 
     30        else 
     31          @_merb_partial_locals = opts         
     32          sent_template = send(template.gsub("/", "__").gsub(".", "_")) rescue nil 
     33        end 
     34 
     35        return sent_template if sent_template 
     36 
     37        raise Merb::ControllerExceptions::TemplateNotFound, "No template matched at #{template}" 
     38      end 
     39 
     40      def method_missing(sym, *args, &blk) 
     41        @_merb_partial_locals[sym] || @web_controller.send(sym, *args, &blk) rescue super 
     42      end 
     43       
    644    end 
    745