Skip to content

Instantly share code, notes, and snippets.

@igaiga
Created April 23, 2014 08:05
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 igaiga/11206406 to your computer and use it in GitHub Desktop.
Save igaiga/11206406 to your computer and use it in GitHub Desktop.
module private
module Mod
private
def mod_a
p "mod_a!"
end
end
class Foo
include Mod
def public_a
p "public_a!"
end
private
def private_a
p "private_a!"
end
end
foo = Foo.new
foo.public_a
foo.mod_a #=> test.rb:21:in `<main>': private method `mod_a' called for #<Foo:0x007fac5b9ddbe0> (NoMethodError)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment