Class: Solargraph::LanguageServer::Host::Cataloger

Inherits:
Object
  • Object
show all
Defined in:
lib/solargraph/language_server/host/cataloger.rb

Overview

An asynchronous library cataloging handler.

Instance Method Summary collapse

Constructor Details

#initialize(host) ⇒ Cataloger

Returns a new instance of Cataloger.



9
10
11
12
# File 'lib/solargraph/language_server/host/cataloger.rb', line 9

def initialize host
  @host = host
  @stopped = true
end

Instance Method Details

#startvoid

This method returns an undefined value.

Start the catalog thread.



31
32
33
34
35
36
37
38
39
40
# File 'lib/solargraph/language_server/host/cataloger.rb', line 31

def start
  return unless stopped?
  @stopped = false
  Thread.new do
    until stopped?
      tick
      sleep 0.01
    end
  end
end

#stopvoid

This method returns an undefined value.

Stop the catalog thread.



17
18
19
# File 'lib/solargraph/language_server/host/cataloger.rb', line 17

def stop
  @stopped = true
end

#stopped?Boolean

True if the cataloger is stopped.

Returns:

  • (Boolean)


24
25
26
# File 'lib/solargraph/language_server/host/cataloger.rb', line 24

def stopped?
  @stopped
end

#tickvoid

This method returns an undefined value.

Perform cataloging.



45
46
47
# File 'lib/solargraph/language_server/host/cataloger.rb', line 45

def tick
  host.catalog
end