这个必须要吐槽一下,否则记不住。
class Hi
#self is point to the Hi class object so it became class instance variable
@class_instance_variable
def a_method
#self is point to the Hi instance so it became instance variable
@instance_variable
end
end
虽然早就知道self这挡子事,但自己就是没往这方面想过,所以看到书上指出来,
还是感到很惊讶, 需要将self的认识提高到一个新的高度。继续拜读 《meteprogramming ruby》。