From: tamouse mailing lists Date: 2013-01-25T02:18:34+09:00 Subject: How to DRY this up? I have some API calls I'm making, all with the following sort of begin-rescue-end wrapper: (pseudo-code) retries = 0 begin response = SomeAPI.api_method1(:request => { 'ThisId' => this_id }) rescue API::Exception => e retries.succ sleep( retries * 5 ) retry unless retries > 2 end where there are multiple api_methods and request forms. Seems like I should be able to DRY this instead of doing this everywhere I have to make this sort of API call.