Methods
Instance Public methods
class_eval(*args, &block)
Link
#class_eval on an object acts like singleton_class.class_eval.
concern(topic, &module_definition)
Link
A shortcut to define a toplevel concern, not within a module.
See Module::Concerning for more.
enable_warnings()
Link
Sets $VERBOSE to true
for the duration of the block and back
to its original value afterwards.
silence_warnings()
Link
Sets $VERBOSE to nil
for the duration of the block and back to
its original value afterwards.
silence_warnings do
value = noisy_call # no warning voiced
end
noisy_call # warning voiced
suppress(*exception_classes)
Link
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'
with_warnings(flag)
Link
Sets $VERBOSE for the duration of the block and back to its original value afterwards.