2 ms·
That may be nasty, but that's how the semantics of method aliasing in Ruby work. Try this Ruby snippet to see what I mean: class Foo def say; puts "h
by jballanc 14y ago
That may be nasty, but that's how the semantics of method aliasing in Ruby work. Try this Ruby snippet to see what I mean:
class Foo
def say; puts "hello"; end
alias shout say
end
class Bar < Foo
def say; puts "howdy"; end
end
Foo.new.say #=> "hello"
Bar.new.say #=> "howdy"
Foo.new.shout #=> "hello"
Bar.new.shout #=> "hello"
- eridius 14y agoOh ugh. When is an alias not an alias? When it's Ruby, I guess.