simpleAop.rb
def withAlias
  Class.class_eval do
    def pre(name, commandstr)
      alias_method "old_#{name}", name
      beforename =  "__before_#{name}"
      evalstr =<<classeval


def #{beforename}(*args, &block)
  #{commandstr}
end

def #{name}(*args, &block)
  __send__ :#{beforename}, *args, &block
  __send__ :old_#{name}, *args, &block
end
classeval
      class_eval evalstr, __FILE__, __LINE__

    end
  end
end
# Can't be invoked twice....
Can't be invoked twice
Can ' t be invoked twice
def withAlias
  Class.class_eval do
    def pre(name, commandstr)
      alias_method "old_#{name}", name
      beforename =  "__before_#{name}"
      evalstr =<<classeval
def #{beforename}(*args, &block)
  #{commandstr}
end
def #{name}(*args, &block)
  __send__ :#{beforename}, *args, &block
  __send__ :old_#{name}, *args, &block
end
classeval
      class_eval evalstr, __FILE__, __LINE__
    end
  end
end
def withAlias Class . class_eval do def pre ( name , commandstr ) alias_method "old_#{name}" , name beforename = "__before_#{name}" evalstr = <<classeval 


def  #{ beforename } (*args, &block)
   #{ commandstr } 
end

def  #{ name } (*args, &block)
  __send__ : #{ beforename } , *args, &block
  __send__ :old_ #{ name } , *args, &block
end
 classeval class_eval evalstr , __FILE__ , __LINE__ end end end
Can't be invoked twice....
Can ' t be invoked twice ....