Skip to content

Instantly share code, notes, and snippets.

@havenwood

havenwood/foo.rb Secret

Created September 8, 2018 17:43
Show Gist options
  • Save havenwood/32dd791c5bb51080f340f016cfc0eee8 to your computer and use it in GitHub Desktop.
Save havenwood/32dd791c5bb51080f340f016cfc0eee8 to your computer and use it in GitHub Desktop.
module Foo
module_function def foo
:foo
end
end
class Bar
include Foo
end
Bar.new.foo
#!> NoMethodError: private method `foo' called for #<Bar:0x00007fe909ae8f40>
class Baz
include Foo
public :foo
end
Baz.new.foo
#=> :foo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment