-
-
Save havenwood/b7dbe3d2afb5a05e09b8371dc8c66c75 to your computer and use it in GitHub Desktop.
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 | |
module_function | |
def function | |
:ok | |
end | |
end | |
class Bar | |
include Foo | |
def it_works_privately | |
function | |
end | |
end | |
Foo.function | |
#=> :ok | |
bar = Bar.new | |
bar.it_works_privately | |
#=> :ok | |
bar.function | |
#!> NoMethodError: private method `function' called for #<Bar:...> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment