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

.constant_updatesObject



79
80
81
82
83
84
85
86
87
88
89
90
91
# File 'lib/solargraph/server.rb', line 79

def constant_updates
  Thread.new {
    loop do
      @@api_hash.keys.each { |k|
        update = Solargraph::ApiMap.new(k)
        @@semaphore.synchronize {
          @@api_hash[k] = update
        }
      }
      sleep 10
    end
  }
end

.prepare_workspace(directory) ⇒ Object



72
73
74
75
76
77
# File 'lib/solargraph/server.rb', line 72

def prepare_workspace directory
  api_map = Solargraph::ApiMap.new(directory)
  @@semaphore.synchronize {
    @@api_hash[directory] = api_map
  }
end

.run!Object



67
68
69
70
# File 'lib/solargraph/server.rb', line 67

def run!
  constant_updates
  super
end

Instance Method Details

#htmlify(object) ⇒ Object



60
61
62
63
64
# File 'lib/solargraph/server.rb', line 60

def htmlify object
  h = Helpers.new
  h.object = object
  h.htmlify object.docstring.all, :rdoc
end