V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
daqing
V2EX  ›  Ruby

你真的理解instance_eval, class_eval和define_method吗?

  •  
  •   daqing · 2011-04-22 14:09:05 +08:00 · 6120 次点击
    这是一个创建于 4724 天前的主题,其中的信息可能已经有所发展或是发生改变。
    https://gist.github.com/936136

    请问a, b, c, d四个方法,分别是实例方法,还是类方法呢?
    2 条回复    1970-01-01 08:00:00 +08:00
    iwinux
        1
    iwinux  
       2011-04-29 05:31:06 +08:00
    a 是 Class 的类方法
    b 是 Test 的类方法
    c 是 Test 的实例方法
    d 是 Test 的类方法

    https://gist.github.com/947384
    lychee
        2
    lychee  
       2011-04-29 08:06:06 +08:00
    - - 来学习下 前两天正好在纠结这几个函数
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   998 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 19:53 · PVG 03:53 · LAX 12:53 · JFK 15:53
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.