Skip to content

Instantly share code, notes, and snippets.

@DazWorrall
Last active February 28, 2019 12:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DazWorrall/505b9b717957549ef94957c5383e2add to your computer and use it in GitHub Desktop.
Save DazWorrall/505b9b717957549ef94957c5383e2add to your computer and use it in GitHub Desktop.
This inheritance behaviour gets me every time
class Foo
A = true
def m
A
end
def n
self.class::A
end
end
class Bar < Foo
A = false
end
puts Bar.new.m # true
puts Bar.new.n # false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment