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.



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

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.



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

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.



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

def token
  self.class.token
end