标签:
11.2 listing object’s method
Oject.methods/singleton_methods/instance_methods
指定类名定义的方法在 singleton_methods
MyClass.method_defined? :my_instance_method
MyClass.respond_to? :my_singleton_method
for ..do/end 不是方法 不创建新的作用域 ,内部创建的变量,如同在外面创建一样
$var 全局变量
a =‘abc’
a<<’,tes’不创建新字符串
bock作参数 用&
def take_block(&block)
block.call
end
take_block do
puts "Block being called in the method!"
end
begin/rescue/end
标签:
原文地址:http://www.cnblogs.com/anjuncc/p/5486410.html