Class: Solargraph::LanguageServer::Host::Cataloger
- Inherits:
-
Object
- Object
- Solargraph::LanguageServer::Host::Cataloger
- Defined in:
- lib/solargraph/language_server/host/cataloger.rb
Overview
An asynchronous library cataloging handler.
Instance Method Summary collapse
-
#initialize(host) ⇒ Cataloger
constructor
A new instance of Cataloger.
-
#start ⇒ void
Start the catalog thread.
-
#stop ⇒ void
Stop the catalog thread.
-
#stopped? ⇒ Boolean
True if the cataloger is stopped.
-
#tick ⇒ void
Perform cataloging.
Constructor Details
#initialize(host) ⇒ Cataloger
Returns a new instance of Cataloger.
10 11 12 13 |
# File 'lib/solargraph/language_server/host/cataloger.rb', line 10 def initialize host @host = host @stopped = true end |
Instance Method Details
#start ⇒ void
This method returns an undefined value.
Start the catalog thread.
32 33 34 35 36 37 38 39 40 41 |
# File 'lib/solargraph/language_server/host/cataloger.rb', line 32 def start return unless stopped? @stopped = false Thread.new do until stopped? tick sleep 0.1 end end end |
#stop ⇒ void
This method returns an undefined value.
Stop the catalog thread.
18 19 20 |
# File 'lib/solargraph/language_server/host/cataloger.rb', line 18 def stop @stopped = true end |
#stopped? ⇒ Boolean
True if the cataloger is stopped.
25 26 27 |
# File 'lib/solargraph/language_server/host/cataloger.rb', line 25 def stopped? @stopped end |
#tick ⇒ void
This method returns an undefined value.
Perform cataloging.
46 47 48 |
# File 'lib/solargraph/language_server/host/cataloger.rb', line 46 def tick host.catalog end |