Sha256: 7d7d276e6178be466fc255ebd85e8c529c4e4dec9c4781fff28121bac54c9c10

Contents?: true

Size: 280 Bytes

Versions: 6

Compression:

Stored size: 280 Bytes

Contents

# CREDIT David Heinemeier Hansson

module Kernel

  # Supress errors while executing a block,
  # with execptions.

  def suppress(*exception_classes)
    begin yield
    rescue Exception => e
      raise unless exception_classes.any? { |cls| e.kind_of?(cls) }
    end
  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
facets-1.8.0 lib/facets/core/kernel/supress.rb
facets-1.8.20 lib/facets/core/kernel/supress.rb
facets-1.8.49 lib/facets/core/kernel/supress.rb
facets-1.8.51 lib/facets/core/kernel/supress.rb
facets-1.8.8 lib/facets/core/kernel/supress.rb
facets-1.8.54 lib/facets/core/kernel/supress.rb