Module: Solargraph::YardLint::Helpers
- Included in:
- Diagnostic
- Defined in:
- lib/solargraph/yard_lint/helpers.rb
Overview
Utility methods for the yard-lint diagnostics reporter.
Class Method Summary collapse
-
.require_yard_lint(version = nil) ⇒ void
Requires a specific version of yard-lint, or the latest installed version if version is ‘nil`.
Class Method Details
.require_yard_lint(version = nil) ⇒ void
This method returns an undefined value.
Requires a specific version of yard-lint, or the latest installed version if version is ‘nil`.
20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/solargraph/yard_lint/helpers.rb', line 20 def require_yard_lint version = nil begin gem_path = Gem::Specification.find_by_name('yard-lint', version).full_gem_path gem_lib_path = File.join(gem_path, 'lib') $LOAD_PATH.unshift(gem_lib_path) unless $LOAD_PATH.include?(gem_lib_path) rescue Gem::MissingSpecVersionError => e specs = e.specs raise InvalidVersionError, "could not find '#{e.name}' (#{e.requirement}) - " \ "did find: [#{specs.map { |s| s.version.version }.join(', ')}]" end require 'yard-lint' end |