module DelayedExceptions
Public Instance Methods
with_delayed_exceptions(enumerable, *catch, &block)
click to toggle source
# File lib/krane/delayed_exceptions.rb, line 4 def with_delayed_exceptions(enumerable, *catch, &block) exceptions = [] enumerable.each do |i| begin block.call(i) rescue *catch => e exceptions << e end end.tap { raise exceptions.first if exceptions.first } end