æ¢åã¡ã½ããã override ããå ´åã以åã®ã¡ã½ãããå¼ã³åºãã«ã¯ alias ã¾ã㯠alias_method ãç¨ãã¦å¥åä¿åãã¦ããã¾ãã alias_method ã®ä¾ alias_method :original_foo, :foo http://wota.jp/ac/?date=20060503#p01 ä¾ ary.size = 10 ã® ary[10] ãåç §ãã㨠ary[0] ãè¿ã Array#[]ã class Array alias_method :org, :[] def [] (n) return org(0) if n > 9 org(n) end end ary = Array.new(10){|i| i} p ary #=> [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] p ary[10] #=> 0
{{#tags}}- {{label}}
{{/tags}}