Yeah, in your code Ruby tries to alias an instance method called :func
defined in the module. Since it doesn’t exist, it doesn’t work. Alias
and alias_method only work on instance methods, but luckily singleton
methods like :func in your example are really instance methods defined
in the singleton class of MyModule.
module MyModule
def MyModule.func
puts ‘Hello’
end
class << self # or, class << MyModule
alias funcAlias func
end
end