Module: Solargraph::Yardoc
- Defined in:
- lib/solargraph/yardoc.rb
Overview
Methods for caching and loading YARD documentation for gems.
Class Method Summary collapse
-
.cache(gemspec) ⇒ String
Build and cache a gem’s yardoc and return the path.
-
.cached?(gemspec) ⇒ Boolean
True if the gem yardoc is cached.
-
.load!(gemspec) ⇒ Array<YARD::CodeObjects::Base>
Load a gem’s yardoc and return its code objects.
- .processing?(gemspec) ⇒ Boolean
Class Method Details
.cache(gemspec) ⇒ String
Build and cache a gem’s yardoc and return the path. If the cache already exists, do nothing and return the path.
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/solargraph/yardoc.rb', line 14 def cache(gemspec) path = PinCache.yardoc_path 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 |
.cached?(gemspec) ⇒ Boolean
True if the gem yardoc is cached.
28 29 30 31 |
# File 'lib/solargraph/yardoc.rb', line 28 def cached?(gemspec) yardoc = File.join(PinCache.yardoc_path(gemspec), 'complete') File.exist?(yardoc) end |
.load!(gemspec) ⇒ Array<YARD::CodeObjects::Base>
Note:
This method modifies the global YARD registry.
Load a gem’s yardoc and return its code objects.
44 45 46 47 |
# File 'lib/solargraph/yardoc.rb', line 44 def load!(gemspec) YARD::Registry.load! PinCache.yardoc_path gemspec YARD::Registry.all end |
.processing?(gemspec) ⇒ Boolean
33 34 35 36 |
# File 'lib/solargraph/yardoc.rb', line 33 def processing?(gemspec) yardoc = File.join(PinCache.yardoc_path(gemspec), 'processing') File.exist?(yardoc) end |