module Solargraph::Yardoc

def cache(gemspec)

Returns:
  • (String) - The path to the cached yardoc.

Parameters:
  • gemspec (Gem::Specification) --
def cache(gemspec)
  path = path_for(gemspec)
  return path if cached?(gemspec)
  Solargraph.logger.info "Caching yardoc for #{gemspec.name} #{gemspec.version}"
  Dir.chdir gemspec.gem_dir do
    `yardoc --db #{path} --no-output --plugin solargraph`
  end
  path
end

def cached?(gemspec)

Parameters:
  • gemspec (Gem::Specification) --
def cached?(gemspec)
  yardoc = File.join(path_for(gemspec), 'complete')
  File.exist?(yardoc)
end

def load!(gemspec)

Returns:
  • (Array) -

Parameters:
  • gemspec (Gem::Specification) --

Other tags:
    Note: - This method modifies the global YARD registry.
def load!(gemspec)
  YARD::Registry.load! path_for(gemspec)
  YARD::Registry.all
end

def path_for(gemspec)

Returns:
  • (String) -

Parameters:
  • gemspec (Gem::Specification) --
def path_for(gemspec)
  File.join(Solargraph::Cache.work_dir, 'gems', "#{gemspec.name}-#{gemspec.version}.yardoc")
end