Created
September 30, 2015 12:57
-
-
Save YusukeIwaki/fae8655232489dff39e5 to your computer and use it in GitHub Desktop.
Rubyのprivateは思ったよりも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 Piyo | |
private | |
def piyo_inner | |
puts "piyo" | |
end | |
end | |
class Hoge | |
def hoge | |
hoge_inner | |
end | |
private | |
def hoge_inner | |
puts "hoge" | |
end | |
end | |
class HogeHoge < Hoge | |
include Piyo | |
def hogehoge | |
hoge_inner | |
piyo_inner | |
end | |
end | |
HogeHoge.new.hogehoge |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment