<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>obelisk2</author_name>
  <author_url>https://blog.hatena.ne.jp/obelisk2/</author_url>
  <blog_title>Camera Obscura</blog_title>
  <blog_url>https://obelisk.hatenablog.com/</blog_url>
  <categories>
    <anon>Ruby</anon>
  </categories>
  <description>n.times_retry でブロック内をエラーがあれば最大 n 回再実行し、それを超えれば停止します。エラーがないかリトライに成功すれば、そのまま次へ処理が渡されます。引数の massage は true ならば情報を出力します（デフォルト true）。wait: n は retry の前に n秒スリーブします（デフォルトは 0）。ブロック引数の i は i 回目の実行ということです。 5.times_retry(message: true, wait: 1) do |i| puts i if i &lt;= 3 raise &quot;sample error&quot; end end puts &quot;success…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fobelisk.hatenablog.com%2Fentry%2F2017%2F01%2F16%2F045102&quot; title=&quot;Ruby 実行のエラー時に n 回リトライするメソッド - Camera Obscura&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url></image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2017-01-16 04:51:02</published>
  <title>Ruby 実行のエラー時に n 回リトライするメソッド</title>
  <type>rich</type>
  <url>https://obelisk.hatenablog.com/entry/2017/01/16/045102</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
