Sha256: dee8f84b59d462188354480fdaddcf37bfc049629592b5fe13f02babeb9cbe94

Contents?: true

Size: 768 Bytes

Versions: 38

Compression:

Stored size: 768 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 memthod 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

38 entries across 34 versions & 5 rubygems

Version Path
cm-admin-1.5.22 vendor/bundle/ruby/3.3.0/gems/rubocop-1.35.1/lib/rubocop/server/helper.rb
cm-admin-1.5.21 vendor/bundle/ruby/3.3.0/gems/rubocop-1.35.1/lib/rubocop/server/helper.rb
cm-admin-1.5.20 vendor/bundle/ruby/3.3.0/gems/rubocop-1.35.1/lib/rubocop/server/helper.rb
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/rubocop-1.31.2/lib/rubocop/server/helper.rb
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/rubocop-1.35.1/lib/rubocop/server/helper.rb
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/rubocop-1.36.0/lib/rubocop/server/helper.rb
scrapbook-0.3.1 vendor/ruby/2.7.0/gems/rubocop-1.31.2/lib/rubocop/server/helper.rb
scrapbook-0.3.1 vendor/ruby/2.7.0/gems/rubocop-1.35.1/lib/rubocop/server/helper.rb
scrapbook-0.3.1 vendor/ruby/2.7.0/gems/rubocop-1.36.0/lib/rubocop/server/helper.rb
call_your_name-0.1.0 vendor/bundle/ruby/3.1.0/gems/rubocop-1.48.1/lib/rubocop/server/helper.rb
rubocop-1.48.1 lib/rubocop/server/helper.rb
rubocop-1.48.0 lib/rubocop/server/helper.rb
rubocop-1.47.0 lib/rubocop/server/helper.rb
zilla-0.2.0 vendor/bundle/ruby/3.2.0/gems/rubocop-1.46.0/lib/rubocop/server/helper.rb
rubocop-1.46.0 lib/rubocop/server/helper.rb
rubocop-1.45.1 lib/rubocop/server/helper.rb
rubocop-1.45.0 lib/rubocop/server/helper.rb
rubocop-1.44.1 lib/rubocop/server/helper.rb
rubocop-1.44.0 lib/rubocop/server/helper.rb
rubocop-1.43.0 lib/rubocop/server/helper.rb