title: How to break out from a ruby block?
body: <p>Here is <code>Bar#do_things</code>:</p>
  
  <pre><code>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
  </code></pre>
  
  <p>And here is <code>Foo#some_method</code>: </p>
  
  <pre><code>class Foo
    def self.some_method(targets, &amp;block)
      targets.each do |target|
        begin
          r = yield(target)
        rescue 
          failed &lt;&lt; target
        end
      end
    end
  end
  </code></pre>
  
  <p>I thought about using raise, but I am trying to make it generic, so I don't want to put anything any specific in <code>Foo</code>.</p>