method

suppress

v2.2.1 - Show latest stable - Class: Kernel
suppress(*exception_classes)
public

Blocks and ignores any exception passed as argument if raised within the block.

  suppress(ZeroDivisionError) do
    1/0
    puts "This code is NOT reached"
  end

  puts "This code gets executed and nothing related to ZeroDivisionError was seen"