1.Require 、 Load 、 Include 、 Extend
Ruby Require VS Load VS Include VS Extend
浅淡Ruby的文件加载与继承
2. hook_methods
3. singleton class
What exactly is the singleton class in ruby?
Understanding Ruby Singleton Classes
4.open the singleton class
open the singleton class of an object with the syntax class << obj
5.reopen class /module
6.alias_method
alias_method
Makes new_name a new copy of the method old_name. This can be used to retain access to methods that are overridden.
7.class_eval, install_eval
Metaprogramming Ruby: class_eval and instance_eval
Understanding class_eval and instance_eval
网友评论