Alle Friday 18 January 2008, Bryan Richardson ha scritto:
> Hello all,
>
> I'm having trouble aliasing class methods. I've tried the following,
> but got errors saying the method being aliased doesn't exist for class
> "Class".
>
> Class Foo
>   class << self
>     alias bar bla
>   end
>
>   def self.bla
>     puts "Hello"
>   end
> end
>
> Foo.bar
>
> Any suggestions? Thanks! -- BTR

The alias statement is executed as soon as it's found, i.e before Foo.bla is 
defined. Since you can't alias something which doesn't exist, you get an 
error. Try switching the order:

Class Foo
  class << self
    alias bar bla
  end

  def self.bla
    puts "Hello"
  end
end

Foo.bar

Stefano