次ã®ã½ã¼ã¹ã³ã¼ãã§ã¯ãFoo#foo()ã¯privateãªã¯ã©ã¹ã¡ã½ããã«ã¯ãªãã¾ããã class Foo private def self.foo return 'foo' end end Foo.foo #=> 'foo' ããã§ãRubyã§ã¯ã©ã¹ã¡ã½ãããprivateã«ããæ¹æ³ã§ãã 1.private_class_methodã使ãæ¹æ³ private_class_methodã¯ãã®åã®éããæå®ããã¡ã½ãããprivateãªã¯ã©ã¹ã¡ã½ããã«ãã¾ãã class Foo def self.foo return 'foo' end def self.bar return 'bar' end private_class_method :foo end Foo.bar #=> 'bar' Foo.foo #=> ã¨ã©ã¼ 2.ç¹ç°ã¯ã©ã¹ã§privateã使ãæ¹æ³ è¤æ°ã®ã¯ã©ã¹ã¡ã½ããã
{{#tags}}- {{label}}
{{/tags}}