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


7
8
9
10
# File 'lib/solargraph/language_server/host/cataloger.rb', line 7

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

Instance Method Details

#startvoid

This method returns an undefined value.

Start the catalog thread.


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

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.


15
16
17
# File 'lib/solargraph/language_server/host/cataloger.rb', line 15

def stop
  @stopped = true
end

#stopped?Boolean

True if the cataloger is stopped.

Returns:

  • (Boolean)

22
23
24
# File 'lib/solargraph/language_server/host/cataloger.rb', line 22

def stopped?
  @stopped
end

#tickvoid

This method returns an undefined value.

Perform cataloging.


43
44
45
# File 'lib/solargraph/language_server/host/cataloger.rb', line 43

def tick
  host.catalog
end