在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
class SomeClass
#method 1 def SomeClass.ClassMethod1 end def self.ClassMethod2 end #method 2 class << self def ClassMethod3 end end end SomeClass.instance_eval do #method 3 def ClassMethod4 end #method 4 define_method(:symbol, ) end #method 5 SomeClass.class_eval do def self.ClassMethod5 end #method 6 class << self def ClassMethod6 end end end #method 7 - dynamically define a class method at run time def add_class_method(c, m, &b) eigenclass = class << c; self; end eigenclass.class_eval { define_method(m, &b) } end |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论