Revision: 18955
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at October 12, 2009 23:08 by shiftyjelly
Initial Code
class Integer def tries options = {}, &block return if self < 1 yield attempts ||= 1 rescue options[:ignoring] || Exception retry if (attempts += 1) <= self end end 3.tries { open 'http://vision-media.ca' } 3.tries do |i| puts "Try ##{i} at opening..." open 'http://vision-media.ca' end 3.tries(:ignoring => ParticularException) do open 'http://vision-media.ca' end
Initial URL
Initial Description
Initial Title
Ruby Tries Method
Initial Tags
ruby
Initial Language
Ruby