Đây là Bar#do_things:
class Bar   
  def do_things
    Foo.some_method(x) do |x|
      y = x.do_something
      return y_is_bad if y.bad? # how do i tell it to stop and return do_things? 
      y.do_something_else
    end
    keep_doing_more_things
  end
end
Và đây là Foo#some_method:
class Foo
  def self.some_method(targets, &block)
    targets.each do |target|
      begin
        r = yield(target)
      rescue 
        failed << target
      end
    end
  end
end
Tôi đã nghĩ về việc sử dụng tăng, nhưng tôi đang cố gắng làm cho nó chung chung, vì vậy tôi không muốn đưa bất cứ điều gì cụ thể vào Foo.