Module: Gitlab::DependencyLinker

Defined in:
lib/gitlab/dependency_linker.rb,
lib/gitlab/dependency_linker/package.rb,
lib/gitlab/dependency_linker/cocoapods.rb,
lib/gitlab/dependency_linker/base_linker.rb,
lib/gitlab/dependency_linker/json_linker.rb,
lib/gitlab/dependency_linker/go_mod_linker.rb,
lib/gitlab/dependency_linker/go_sum_linker.rb,
lib/gitlab/dependency_linker/method_linker.rb,
lib/gitlab/dependency_linker/gemfile_linker.rb,
lib/gitlab/dependency_linker/gemspec_linker.rb,
lib/gitlab/dependency_linker/parser/gemfile.rb,
lib/gitlab/dependency_linker/podfile_linker.rb,
lib/gitlab/dependency_linker/podspec_linker.rb,
lib/gitlab/dependency_linker/cartfile_linker.rb,
lib/gitlab/dependency_linker/cargo_toml_linker.rb,
lib/gitlab/dependency_linker/godeps_json_linker.rb,
lib/gitlab/dependency_linker/package_json_linker.rb,
lib/gitlab/dependency_linker/podspec_json_linker.rb,
lib/gitlab/dependency_linker/composer_json_linker.rb,
lib/gitlab/dependency_linker/requirements_txt_linker.rb

Defined Under Namespace

Modules: Cocoapods, Parser Classes: BaseLinker, CargoTomlLinker, CartfileLinker, ComposerJsonLinker, GemfileLinker, GemspecLinker, GoModLinker, GoSumLinker, GodepsJsonLinker, JsonLinker, MethodLinker, Package, PackageJsonLinker, PodfileLinker, PodspecJsonLinker, PodspecLinker, RequirementsTxtLinker

Constant Summary collapse

LINKERS =
[
  GemfileLinker,
  GemspecLinker,
  PackageJsonLinker,
  ComposerJsonLinker,
  PodfileLinker,
  PodspecLinker,
  PodspecJsonLinker,
  CartfileLinker,
  GodepsJsonLinker,
  RequirementsTxtLinker,
  CargoTomlLinker,
  GoModLinker,
  GoSumLinker
].freeze

Class Method Summary collapse

Class Method Details


25
26
27
28
29
30
# File 'lib/gitlab/dependency_linker.rb', line 25

def self.link(blob_name, plain_text, highlighted_text)
  linker = linker(blob_name)
  return highlighted_text unless linker

  linker.link(plain_text, highlighted_text)
end

.linker(blob_name) ⇒ Object


21
22
23
# File 'lib/gitlab/dependency_linker.rb', line 21

def self.linker(blob_name)
  LINKERS.find { |linker| linker.support?(blob_name) }
end