(追è¨:æ®éã«metametametametaclassã¨ãã«ããã°è¯ãã£ããä¿®æ£ã¯ä¸ç¬ã ãã©ã)
多段特異クラス - チナミニã§ãæ±ãå®è£ ããããã¦ãã¾ãããããã®å¾ã好ã¿ç¼ããç¼ãã¦ããéã«ç´ æ´ãããå®è£ ãæãã¤ããã®ã§å ±åãããã¾ãã
class Class def method_missing(meth, *args) if meth.to_s =~ /\Ame((?:ta)+)class\z/ level = $1.gsub(/ta/).count level.times.inject(self) {|klass, _| class << klass; self end } else super end end end p Object.metaclass #=> #<Class:Object> p Object.metatataclass #=> #<Class:#<Class:#<Class:Object>>>
'ta'ã®æ°ã«ãã£ã¦ä½æ®µãå¤ããã¾ãã
æ®éã«ç¹ç°ã¯ã©ã¹ãå¾ãããã®ã§ãã¨ã¦ãå®ç¨çã§ããï¼
誰ãã空æ°èªã¾ãã«ãç¹ç°ã¡ã½ãããåå¾ã§ããã¡ã½ãããRubyèªèº«ã«å®è£ ããªãããªãã¤ã¼ã¹ã¿ã¼ã¨ãã°ã¨ãã¦ã