Class: RuboCop::Server::Core Private

Inherits:
Object
  • Object
show all
Defined in:
lib/rubocop/server/core.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

The core of server process. It starts TCP server and perform socket communication.

Constant Summary collapse

JSON_FORMATS =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

%w[json j].freeze

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.tokenObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



22
23
24
# File 'lib/rubocop/server/core.rb', line 22

def self.token
  @token ||= SecureRandom.hex(4)
end

Instance Method Details

#start(host, port, detach: true) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



30
31
32
33
34
35
36
37
38
39
# File 'lib/rubocop/server/core.rb', line 30

def start(host, port, detach: true)
  $PROGRAM_NAME = "rubocop --server #{Cache.project_dir}"

  require_relative '../../rubocop'
  start_server(host, port)

  return unless server_mode?

  detach ? detach_server : run_server
end

#tokenObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



26
27
28
# File 'lib/rubocop/server/core.rb', line 26

def token
  self.class.token
end