Sha256: 17366c9e032dd0fead75df7c1db10bfe574bae8d1b9b839ff2cd2ceaf28d0eb4

Contents?: true

Size: 767 Bytes

Versions: 152

Compression:

Stored size: 767 Bytes

Contents

# frozen_string_literal: true

#
# This code is based on https://github.com/fohte/rubocop-daemon.
#
# Copyright (c) 2018 Hayato Kawai
#
# The MIT License (MIT)
#
# https://github.com/fohte/rubocop-daemon/blob/master/LICENSE.txt
#
module RuboCop
  module Server
    # This module has a helper method for `RuboCop::Server::SocketReader`.
    # @api private
    module Helper
      def self.redirect(stdin: $stdin, stdout: $stdout, stderr: $stderr, &_block)
        old_stdin = $stdin.dup
        old_stdout = $stdout.dup
        old_stderr = $stderr.dup

        $stdin = stdin
        $stdout = stdout
        $stderr = stderr

        yield
      ensure
        $stdin = old_stdin
        $stdout = old_stdout
        $stderr = old_stderr
      end
    end
  end
end

Version data entries

152 entries across 151 versions & 15 rubygems

Version Path
rubocop-1.71.0 lib/rubocop/server/helper.rb
rubocop-1.70.0 lib/rubocop/server/helper.rb
minato_ruby_api_client-0.2.2 vendor/bundle/ruby/3.2.0/gems/rubocop-1.64.1/lib/rubocop/server/helper.rb
rubocop-1.69.2 lib/rubocop/server/helper.rb
rubocop-1.69.1 lib/rubocop/server/helper.rb
rubocop-1.69.0 lib/rubocop/server/helper.rb
rubocop-1.68.0 lib/rubocop/server/helper.rb
rubocop-1.67.0 lib/rubocop/server/helper.rb
rubocop-1.66.1 lib/rubocop/server/helper.rb
rubocop-1.66.0 lib/rubocop/server/helper.rb
rubocop-1.65.1 lib/rubocop/server/helper.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/rubocop-1.64.1/lib/rubocop/server/helper.rb
rubocop-1.65.0 lib/rubocop/server/helper.rb
katalyst-govuk-formbuilder-1.9.2 vendor/bundle/ruby/3.3.0/gems/rubocop-1.64.1/lib/rubocop/server/helper.rb
rubocop-1.64.1 lib/rubocop/server/helper.rb
rubocop-1.63.4 lib/rubocop/server/helper.rb
rubocop-1.63.3 lib/rubocop/server/helper.rb
rubocop-1.63.2 lib/rubocop/server/helper.rb
harbr-2.8.1 vendor/bundle/ruby/3.2.0/gems/rubocop-1.57.2/lib/rubocop/server/helper.rb
rubocop-1.63.1 lib/rubocop/server/helper.rb