obj = Object.new def obj.a puts 'original method' end class << obj alias b a def a b puts 'appended' end end obj.a # Output: # original method # appended
class << Object.new p self # => #<Class:#<Object:0x00000002aa81b8>> end
欢迎光临 Project1 (https://rpg.blue/) | Powered by Discuz! X3.1 |