Method: Solargraph::Diagnostics::RubocopHelpers.redirect_stdout

Defined in:
lib/solargraph/diagnostics/rubocop_helpers.rb

.redirect_stdoutString

TODO:

This is a smelly way to redirect output, but the RuboCop specs do the same thing.

Returns:

  • (String)


56
57
58
59
60
61
62
# File 'lib/solargraph/diagnostics/rubocop_helpers.rb', line 56

def redirect_stdout
  redir = StringIO.new
  $stdout = redir
  yield if block_given?
  $stdout = STDOUT
  redir.string
end