第240页 附录C 法术手册
orcl_zhang (槑)
读过 Ruby元编程
- 章节名:附录C 法术手册
- 页码:第240页
白板
class C instance_methods.each do |m| undef_method(m) unless m.to_s =~ /^__|method_missing|respond_to?/ end def method_missing(name,*args) puts "a Ghost Method" end end obj = C.new obj.to_s #=> "a Ghost Method"
27人阅读
orcl_zhang对本书的所有笔记 · · · · · ·
-
第232页 附录A 常见惯用法
tap()方法 class Object def tap yield self self end end
-
第233页 附录A 常见惯用法
A.5 Symbol#to_proc()方法 names = ["bob","bill","tom"] names.map(&:capitalize) 为什么可...
-
第240页 附录C 法术手册
> 查看全部21篇
说明 · · · · · ·
表示其中内容是对原文的摘抄