title: Extending a class method in a module
body: <p>I'm playing with ruby's metaprogramming features, and I'm finding it a bit hairy. I'm trying to wrap a method call using a module. Currently, I'm doing this:</p>
  
  <pre><code>module Bar
    module ClassMethods
      def wrap(method)
        class_eval do
          old_method = "wrapped_#{method}".to_sym
          unless respond_to? old_method
            alias_method old_method, method
  
            define_method method do |*args|
              send old_method, *args
            end
          end
        end
      end
    end
  
    def self.included(base)
      base.extend ClassMethods
    end
  end
  
  class Foo
    include Bar
  
    def bar(arg = 'foo')
      puts arg
    end
  
    wrap :bar
  end
  </code></pre>
  
  <p>Three questions:</p>
  
  <ol>
  <li><p>Is there any way to do this without renaming the method, so as to allow the use of <code>super</code>? Or something cleaner/shorter?</p></li>
  <li><p>Is there a clean way to set the default values?</p></li>
  <li><p>Is there a means to move the <code>wrap :bar</code> call further up?</p></li>
  </ol>