Class Class
In: lib/mues/utils.rb  (CVS)
Parent: Object

A couple of utility methods for the Class class.

Class::alias_class_method
Create an alias for a class method. Borrowed from RubyTreasures by Paul Brannan <paul@nospam.atdesk.com>.

Methods

Public Instance methods

Alias a class method.

[Source]

# File lib/mues/utils.rb, line 54
    def alias_class_method( newSym, oldSym )
        retval = nil
        eval %{
          class << self
            retval = alias_method :#{newSym}, :#{oldSym}
          end
        }
        return retval
    rescue Exception => err
        # Mangle exceptions to point someplace useful
        frames = err.backtrace
        frames.shift while frames.first =~ /#{__FILE__}/
        Kernel::raise err, err.message.gsub(/in `\w+'/, "in `alias_class_method'"), frames
    end

[Validate]