Created
August 23, 2021 21:48
-
-
Save timuruski/8daf010ea0ae1b5cdb8bd21d1b84acb1 to your computer and use it in GitHub Desktop.
An example of private methods colliding in modules.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Foo | |
def foo | |
blah | |
end | |
private def blah | |
"foo" | |
end | |
end | |
module Bar | |
def bar | |
blah | |
end | |
private def blah | |
"bar" | |
end | |
end | |
class Meep | |
include Foo | |
include Bar | |
end | |
puts Meep.new.foo # => "bar" 😱 | |
puts Meep.new.bar # => "bar" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment