Skip to content

Instantly share code, notes, and snippets.

@havenwood
Last active September 8, 2018 17:20
Show Gist options
  • Save havenwood/b7dbe3d2afb5a05e09b8371dc8c66c75 to your computer and use it in GitHub Desktop.
Save havenwood/b7dbe3d2afb5a05e09b8371dc8c66c75 to your computer and use it in GitHub Desktop.
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