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_updates ⇒ Object



83
84
85
86
87
88
89
90
91
92
93
94
95
# File 'lib/solargraph/server.rb', line 83

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



73
74
75
76
77
78
79
80
81
# File 'lib/solargraph/server.rb', line 73

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

.run! ⇒ Object



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

def run!
  #constant_updates
  super
end

Instance Method Details

#htmlify(object) ⇒ Object



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

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