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.
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
#start ⇒ void
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.1 end end end |
#stop ⇒ void
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.
24 25 26 |
# File 'lib/solargraph/language_server/host/cataloger.rb', line 24 def stopped? @stopped end |
#tick ⇒ void
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 |