【发布时间】:2012-12-24 23:19:28
【问题描述】:
如果一个人想屈服于调用者的调用者的阻塞,应该如何进行?我想出了以下几点:
def method1(param)
method2(param) { |x| yield x if block_given? }
end
def method2(param)
yield(param) if block_given? # Can I yield from here
end
method1("String") { |x| puts x } # to here in a more elegant way?
【问题讨论】:
标签: ruby