Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
たとえば、「puts」メソッドをオーバーライドして、「puts」を 2 回呼び出す関数に置き換えることはできますか?
例えば:
class IO def puts str puts str puts str end end
この例がばかげていることはわかっていますが、別の目的で必要です。基本的に、関数をオーバーライドしたいのですが、オーバーライド関数に元のオーバーライドされた関数への呼び出しを含めたいです。
class IO alias puts_orig puts def puts str puts_orig str puts_orig str end end