在proc中调用proc ( call proc in another proc ... )

访问量: 2695

这是个问题...

hi_proc = proc { |another_proc|
  puts 'hihihi'
  another_proc.call
}
name_proc = proc { puts 'jim' }
puts hi_proc.call(name_proc)
# hihihi
# jim

订阅/RSS Feed

Subscribe