Class: RuboCop::Daemon::Server
- Inherits:
-
Object
- Object
- RuboCop::Daemon::Server
- Defined in:
- lib/rubocop/daemon/server.rb
Instance Attribute Summary collapse
-
#verbose ⇒ Object
readonly
Returns the value of attribute verbose.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(verbose) ⇒ Server
constructor
A new instance of Server.
- #start(port) ⇒ Object
- #token ⇒ Object
Constructor Details
#initialize(verbose) ⇒ Server
Returns a new instance of Server.
16 17 18 |
# File 'lib/rubocop/daemon/server.rb', line 16 def initialize(verbose) @verbose = verbose end |
Instance Attribute Details
#verbose ⇒ Object (readonly)
Returns the value of attribute verbose.
10 11 12 |
# File 'lib/rubocop/daemon/server.rb', line 10 def verbose @verbose end |
Class Method Details
.token ⇒ Object
12 13 14 |
# File 'lib/rubocop/daemon/server.rb', line 12 def self.token @token ||= SecureRandom.hex(4) end |
Instance Method Details
#start(port) ⇒ Object
24 25 26 27 28 29 30 31 32 |
# File 'lib/rubocop/daemon/server.rb', line 24 def start(port) require 'rubocop' start_server(port) Cache.write_port_and_token_files(port: @server.addr[1], token: token) Process.daemon(true) unless verbose Cache.write_pid_file do read_socket(@server.accept) until @server.closed? end end |
#token ⇒ Object
20 21 22 |
# File 'lib/rubocop/daemon/server.rb', line 20 def token self.class.token end |