Skip to content

Instantly share code, notes, and snippets.

@lsegal
Created November 25, 2009 23:11
Show Gist options
  • Save lsegal/243084 to your computer and use it in GitHub Desktop.
Save lsegal/243084 to your computer and use it in GitHub Desktop.
Don't use aliases, they bypass classical inheritance rules you'd expect when you override methods
class A
def read(key) raise NotImplementedError end
alias [] read
end
class B < A
def read(key) puts key end
end
B.new[:x] # NotImplementedError
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment