Created
April 23, 2014 08:05
-
-
Save igaiga/11206406 to your computer and use it in GitHub Desktop.
module private
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 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