Class: Solargraph::Server

Inherits:
Sinatra::Base
  • Object
show all
Defined in:
lib/solargraph/server.rb

Defined Under Namespace

Classes: Helpers

Constant Summary collapse

@@api_hash =
{}
@@semaphore =
Mutex.new

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.get_api_map(workspace) ⇒ Solargraph::ApiMap

Returns:



141
142
143
144
145
146
147
# File 'lib/solargraph/server.rb', line 141

def self.get_api_map workspace
  api_map = nil
  @@semaphore.synchronize {
    api_map = @@api_hash[workspace]
  }
  api_map
end

.prepare_workspace(directory) ⇒ Object



169
170
171
172
173
174
175
176
177
# File 'lib/solargraph/server.rb', line 169

def prepare_workspace directory
  Thread.new do
    api_map = Solargraph::ApiMap.new(directory)
    api_map.yard_map
    @@semaphore.synchronize do
      @@api_hash[directory] = api_map
    end
  end
end

.wait ⇒ Object



18
19
20
21
# File 'lib/solargraph/server.rb', line 18

def self.wait
  @@semaphore.lock
  @@semaphore.unlock
end

Instance Method Details

#get_api_map(workspace) ⇒ Solargraph::ApiMap

Returns:



150
151
152
# File 'lib/solargraph/server.rb', line 150

def get_api_map workspace
  Server.get_api_map workspace
end

#htmlify(text) ⇒ Object



154
155
156
# File 'lib/solargraph/server.rb', line 154

def htmlify text
  rdoc_to_html text
end

#rdoc_to_html(text) ⇒ Object



158
159
160
161
# File 'lib/solargraph/server.rb', line 158

def rdoc_to_html text
  h = Helpers.new
  h.html_markup_rdoc(text)
end

#ruby_to_html(code) ⇒ Object



163
164
165
166
# File 'lib/solargraph/server.rb', line 163

def ruby_to_html code
  h = Helpers.new
  h.html_markup_ruby(code)
end