PageSourceSearch

https://rubygems.org/assets/src/transitive_dependencies-9280dc42.js

js rubygems.org collected 2026-10-01 06:49:00 UTC 2,322 bytes, 68 lines download raw bytes

1document.addEventListener("click", function (event) {
2  const trigger = event.target.closest(".deps_expanded-link");
3  if (!trigger) return;
4  event.preventDefault();
5  try {
6    const gemId = trigger.dataset.gemId;
7    const versionId = trigger.dataset.version;
8    const url = `/gems/${gemId}/versions/${versionId}/dependencies.json`;
9    fetch(url, { method: "GET" })
10      .then((response) => response.json())
11      .then((resp) => {
12        renderDependencies(resp, trigger);
13      })
14      .catch(() => {
15        const error_message =
16          "<ul class='deps_item--error'>Request failed. please reload the page and try again</ul>";
17        const container =
18          trigger.parentElement.nextElementSibling.nextElementSibling;
19        if (container) container.innerHTML = error_message;
20      });
21  } catch (e) {
22    alert(e);
23  }
24});
25
26function renderDependencies(resp, current) {
27  scope_display(current, resp.run_html, "runtime");
28  scope_display(current, resp.dev_html, "development");
29  arrow_toggler(current);
30}
31
32function arrow_toggler(current) {
33  const toggler =
34    "<span class='deps_expanded arrow_toggle deps_expanded-down'></span>";
35  const parent = current.parentElement;
36  if (parent) parent.innerHTML = toggler;
37}
38
39function scope_display(current, deps, scope) {
40  if (deps.length !== 0) {
41    let new_gems = current.parentElement.nextElementSibling.nextElementSibling;
42    if (scope === "development") {
43      new_gems = new_gems.nextElementSibling;
44    }
45    const scopeContainer = new_gems.querySelector(".deps_scope");
46    if (scopeContainer) scopeContainer.insertAdjacentHTML("beforeend", deps);
47  }
48}
49
50document.addEventListener("click", function (event) {
51  const el = event.target.closest(".scope");
52  if (!el) return;
53  el.classList.toggle("scope--expanded");
54  if (el.nextElementSibling)
55    el.nextElementSibling.classList.toggle("deps_toggle");
56});
57
58document.addEventListener("click", function (event) {
59  const el = event.target.closest(".arrow_toggle");
60  if (!el) return;
61  const runtime_div = el.parentElement.nextElementSibling.nextElementSibling;
62  if (runtime_div) {
63    runtime_div.classList.toggle("deps_toggle");
64    if (runtime_div.nextElementSibling)
65      runtime_div.nextElementSibling.classList.toggle("deps_toggle");
66  }
67  el.classList.toggle("deps_expanded-down");
68});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.