<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -14,6 +14,16 @@ module Waves
         end
         ret
       end
+      
+      def cache_method_missing(name, method_body, *args, &amp;block)
+        self.class.module_eval &lt;&lt;-METHOD
+          def #{name}(*args, &amp;block)
+            #{method_body}
+          end
+        METHOD
+        self.send(name, *args, &amp;block)
+      end
+      
     end
   end
 end</diff>
      <filename>lib/ext/object.rb</filename>
    </modified>
    <modified>
      <diff>@@ -26,7 +26,7 @@ module Waves
     
     # Forwards logging methods to the logger.
     def self.method_missing(name,*args,&amp;block)
-      @log.send name,*args, &amp;block if @log
+      cache_method_missing name, &quot;@log.#{name} *args, &amp;block if @log&quot;, *args, &amp;block
     end
 
   end</diff>
      <filename>lib/runtime/logger.rb</filename>
    </modified>
    <modified>
      <diff>@@ -53,10 +53,16 @@ module Waves
     
     # access HTTP headers as methods
     def method_missing( name, *args, &amp;body )
-      return super unless args.empty? and body.nil?
-      key = &quot;HTTP_#{name.to_s.upcase}&quot; 
-      @request.env[ key ] if @request.env.has_key?( key )
+      if args.empty? and not body
+        cache_method_missing name, &lt;&lt;-CODE, *args, &amp;body
+          key = &quot;HTTP_#{name.to_s.upcase}&quot;
+          @request.env[ key ] if @request.env.has_key?( key )
+        CODE
+      else
+        super
+      end
     end
+    
 
     # Raise a not found exception.
     def not_found</diff>
      <filename>lib/runtime/request.rb</filename>
    </modified>
    <modified>
      <diff>@@ -36,7 +36,7 @@ module Waves
     # Methods not explicitly defined by Waves::Response are delegated to Rack::Response.
     # Check the Rack documentation for more informations
     def method_missing(name,*args)
-      @response.send(name,*args)
+      cache_method_missing name, &quot;@response.#{name} *args&quot;, *args
     end
 
   end</diff>
      <filename>lib/runtime/response.rb</filename>
    </modified>
    <modified>
      <diff>@@ -25,7 +25,9 @@ module Waves
   def self.version ; File.read( File.expand_path( &quot;#{File.dirname(__FILE__)}/../../doc/VERSION&quot; ) ) ; end
   def self.license ; File.read( File.expand_path( &quot;#{File.dirname(__FILE__)}/../../doc/LICENSE&quot; ) ) ; end
   
-  def self.method_missing(name,*args,&amp;block) ; instance.send(name,*args,&amp;block) ; end
+  def self.method_missing(name,*args,&amp;block)
+    cache_method_missing name, &quot;instance.#{name}( *args, &amp;block)&quot;, *args, &amp;block
+  end
 
   # A Waves::Runtime takes an inert application module and gives it concrete, pokeable form.
   # Waves::Server and Waves::Console are types of runtime.</diff>
      <filename>lib/runtime/runtime.rb</filename>
    </modified>
    <modified>
      <diff>@@ -48,9 +48,10 @@ module Waves
         Waves.log.debug &quot;Rendering template: #{qpath}&quot;
         Views.render( :templates / qpath, assigns.merge!( :request =&gt; request ))
       end
-
-      # Render the template with the name of the missing method.
-      def method_missing(name,*args) ; render( name, *args ) ; end
+      
+      def method_missing(name, *args)
+        cache_method_missing name, &quot;self.render(:#{name}, *args)&quot;, *args 
+      end
 
     end
 </diff>
      <filename>lib/views/mixin.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>0d18f903f8602068d2d45f968da9d814c6a5f07c</id>
    </parent>
  </parents>
  <author>
    <name>Matthew King</name>
    <email>automatthew@gmail.com</email>
  </author>
  <url>http://github.com/dyoder/waves/commit/60681255df2ea94b01c289ee5ce510f417f483c4</url>
  <id>60681255df2ea94b01c289ee5ce510f417f483c4</id>
  <committed-date>2008-12-29T12:31:38-08:00</committed-date>
  <authored-date>2008-12-29T12:31:38-08:00</authored-date>
  <message>introduced caching for method_missing calls</message>
  <tree>d9352a934f47b8402d3b239c49db7a6f086bfe4b</tree>
  <committer>
    <name>Matthew King</name>
    <email>automatthew@gmail.com</email>
  </committer>
</commit>
