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
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.