摘要: 1 #当前块 2 class Block 3 def a_method 4 return yield if block_given? 5 'no block' 6 end 7 end 8 obj=Block.new 9 puts "#{obj.a_m... 阅读全文
posted @ 2014-08-27 18:01 翌子涵 阅读(136) 评论(0) 推荐(0) 编辑
摘要: 1 #全局变量2 $global_variable=103 class Class14 def print_global()5 puts "Global variable in Class1 is #{$global_variable}"6 end7 end8 cla... 阅读全文
posted @ 2014-08-27 17:53 翌子涵 阅读(230) 评论(0) 推荐(0) 编辑