Here is an example:
It is common to make such mistake in spec_helper
, Rakefile
, etc.
# Temporarily redirects STDOUT and STDERR to /dev/null | |
# but does print exceptions should there occur any. | |
# Call as: | |
# suppress_output { puts 'never printed' } | |
# | |
def suppress_output | |
original_stderr = $stderr.clone | |
original_stdout = $stdout.clone | |
$stderr.reopen(File.new('/dev/null', 'w')) | |
$stdout.reopen(File.new('/dev/null', 'w')) |
Yet another hack how to enable the syntax highlighting for the byebug gem.
Works for v10.0.0 and higher.
Place the content of byebug_syntax_highlighting.rb somewhere in your codebase (Inside an initializer for example, if you are using Rails).
Do not forget to include byebug and rouge to the Gemfile as well.