yard 0.9.39 → 0.9.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +16 -1
- data/README.md +18 -21
- data/docs/GettingStarted.md +41 -15
- data/docs/Tags.md +5 -5
- data/docs/WhatsNew.md +59 -7
- data/docs/templates/default/yard_tags/html/setup.rb +1 -1
- data/lib/yard/autoload.rb +17 -0
- data/lib/yard/cli/diff.rb +7 -2
- data/lib/yard/code_objects/proxy.rb +1 -1
- data/lib/yard/handlers/processor.rb +1 -0
- data/lib/yard/handlers/rbs/attribute_handler.rb +43 -0
- data/lib/yard/handlers/rbs/base.rb +38 -0
- data/lib/yard/handlers/rbs/constant_handler.rb +18 -0
- data/lib/yard/handlers/rbs/method_handler.rb +327 -0
- data/lib/yard/handlers/rbs/mixin_handler.rb +20 -0
- data/lib/yard/handlers/rbs/namespace_handler.rb +26 -0
- data/lib/yard/handlers/ruby/attribute_handler.rb +7 -4
- data/lib/yard/handlers/ruby/constant_handler.rb +1 -0
- data/lib/yard/i18n/locale.rb +1 -1
- data/lib/yard/i18n/pot_generator.rb +1 -1
- data/lib/yard/parser/rbs/rbs_parser.rb +325 -0
- data/lib/yard/parser/rbs/statement.rb +75 -0
- data/lib/yard/parser/ruby/ruby_parser.rb +51 -1
- data/lib/yard/parser/source_parser.rb +3 -2
- data/lib/yard/registry_resolver.rb +7 -0
- data/lib/yard/server/library_version.rb +1 -1
- data/lib/yard/server/templates/default/fulldoc/html/js/autocomplete.js +208 -12
- data/lib/yard/server/templates/default/layout/html/breadcrumb.erb +1 -17
- data/lib/yard/server/templates/default/method_details/html/permalink.erb +4 -2
- data/lib/yard/server/templates/doc_server/library_list/html/headers.erb +3 -3
- data/lib/yard/server/templates/doc_server/library_list/html/library_list.erb +2 -3
- data/lib/yard/server/templates/doc_server/processing/html/processing.erb +22 -16
- data/lib/yard/tags/directives.rb +7 -0
- data/lib/yard/tags/library.rb +3 -3
- data/lib/yard/tags/types_explainer.rb +2 -1
- data/lib/yard/templates/helpers/base_helper.rb +1 -1
- data/lib/yard/templates/helpers/html_helper.rb +15 -4
- data/lib/yard/templates/helpers/html_syntax_highlight_helper.rb +6 -1
- data/lib/yard/templates/helpers/markup/hybrid_markdown.rb +2125 -0
- data/lib/yard/templates/helpers/markup_helper.rb +4 -2
- data/lib/yard/version.rb +1 -1
- data/po/ja.po +82 -82
- data/templates/default/fulldoc/html/full_list.erb +4 -4
- data/templates/default/fulldoc/html/js/app.js +503 -319
- data/templates/default/fulldoc/html/js/full_list.js +310 -213
- data/templates/default/layout/html/headers.erb +1 -1
- data/templates/default/method/html/header.erb +3 -3
- data/templates/default/module/html/defines.erb +3 -3
- data/templates/default/module/html/inherited_methods.erb +1 -0
- data/templates/default/module/html/method_summary.erb +8 -0
- data/templates/default/module/setup.rb +20 -0
- data/templates/default/onefile/html/layout.erb +3 -4
- data/templates/guide/fulldoc/html/js/app.js +57 -26
- data/templates/guide/layout/html/layout.erb +9 -11
- metadata +13 -4
|
@@ -1,245 +1,342 @@
|
|
|
1
1
|
(function() {
|
|
2
|
+
var clicked = null;
|
|
3
|
+
var searchTimeout = null;
|
|
4
|
+
var searchCache = [];
|
|
5
|
+
var caseSensitiveMatch = false;
|
|
6
|
+
var ignoreKeyCodeMin = 8;
|
|
7
|
+
var ignoreKeyCodeMax = 46;
|
|
8
|
+
var commandKey = 91;
|
|
2
9
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var caseSensitiveMatch = false;
|
|
7
|
-
var ignoreKeyCodeMin = 8;
|
|
8
|
-
var ignoreKeyCodeMax = 46;
|
|
9
|
-
var commandKey = 91;
|
|
10
|
+
function query(selector, root) {
|
|
11
|
+
return (root || document).querySelector(selector);
|
|
12
|
+
}
|
|
10
13
|
|
|
11
|
-
|
|
12
|
-
return
|
|
13
|
-
|
|
14
|
+
function queryAll(selector, root) {
|
|
15
|
+
return Array.prototype.slice.call(
|
|
16
|
+
(root || document).querySelectorAll(selector)
|
|
17
|
+
);
|
|
18
|
+
}
|
|
14
19
|
|
|
15
|
-
function
|
|
16
|
-
|
|
17
|
-
if (
|
|
18
|
-
|
|
20
|
+
function isVisible(element) {
|
|
21
|
+
if (!element) return false;
|
|
22
|
+
if (window.getComputedStyle(element).display === "none") return false;
|
|
23
|
+
if (element.parentElement && element.parentElement !== document.body) {
|
|
24
|
+
return isVisible(element.parentElement);
|
|
19
25
|
}
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
function
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
$('#full_list li').on('click', function(evt) {
|
|
31
|
-
$('#full_list li').removeClass('clicked');
|
|
32
|
-
$clicked = $(this);
|
|
33
|
-
$clicked.addClass('clicked');
|
|
34
|
-
evt.stopPropagation();
|
|
35
|
-
|
|
36
|
-
if (window.origin === "null") {
|
|
37
|
-
if (evt.target.tagName === 'A') return true;
|
|
38
|
-
|
|
39
|
-
var elem = $clicked.find('> .item .object_link a')[0];
|
|
40
|
-
var e = evt.originalEvent;
|
|
41
|
-
var newEvent = new MouseEvent(evt.originalEvent.type);
|
|
42
|
-
newEvent.initMouseEvent(e.type, e.canBubble, e.cancelable, e.view, e.detail, e.screenX, e.screenY, e.clientX, e.clientY, e.ctrlKey, e.altKey, e.shiftKey, e.metaKey, e.button, e.relatedTarget);
|
|
43
|
-
elem.dispatchEvent(newEvent);
|
|
44
|
-
evt.preventDefault();
|
|
26
|
+
return true;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
RegExp.escape = function(text) {
|
|
30
|
+
return text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
function ready(callback) {
|
|
34
|
+
if (document.readyState === "loading") {
|
|
35
|
+
document.addEventListener("DOMContentLoaded", callback, { once: true });
|
|
45
36
|
} else {
|
|
46
|
-
|
|
47
|
-
try {
|
|
48
|
-
url = new URL(url, window.location.href).href;
|
|
49
|
-
} catch { }
|
|
50
|
-
window.top.postMessage({ action: "navigate", url: url }, "*");
|
|
37
|
+
callback();
|
|
51
38
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function escapeShortcut() {
|
|
42
|
+
document.addEventListener("keydown", function(event) {
|
|
43
|
+
if (event.key === "Escape") {
|
|
44
|
+
window.parent.postMessage("navEscape", "*");
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function clearSearchTimeout() {
|
|
50
|
+
clearTimeout(searchTimeout);
|
|
51
|
+
searchTimeout = null;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function setClicked(item) {
|
|
55
|
+
queryAll("#full_list li.clicked").forEach(function(node) {
|
|
56
|
+
node.classList.remove("clicked");
|
|
57
|
+
});
|
|
58
|
+
clicked = item;
|
|
59
|
+
if (clicked) clicked.classList.add("clicked");
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function enableLinks() {
|
|
63
|
+
queryAll("#full_list li").forEach(function(item) {
|
|
64
|
+
item.addEventListener("click", function(event) {
|
|
65
|
+
var targetLink;
|
|
66
|
+
var mouseEvent;
|
|
67
|
+
var url;
|
|
68
|
+
|
|
69
|
+
setClicked(item);
|
|
70
|
+
event.stopPropagation();
|
|
71
|
+
|
|
72
|
+
if (window.origin === "null") {
|
|
73
|
+
if (event.target.tagName === "A") return true;
|
|
74
|
+
|
|
75
|
+
targetLink = item.querySelector(":scope > .item .object_link a");
|
|
76
|
+
if (!targetLink) return false;
|
|
77
|
+
mouseEvent = new MouseEvent("click", {
|
|
78
|
+
bubbles: true,
|
|
79
|
+
cancelable: true,
|
|
80
|
+
view: event.view || window,
|
|
81
|
+
detail: event.detail,
|
|
82
|
+
screenX: event.screenX,
|
|
83
|
+
screenY: event.screenY,
|
|
84
|
+
clientX: event.clientX,
|
|
85
|
+
clientY: event.clientY,
|
|
86
|
+
ctrlKey: event.ctrlKey,
|
|
87
|
+
shiftKey: event.shiftKey,
|
|
88
|
+
altKey: event.altKey,
|
|
89
|
+
metaKey: event.metaKey,
|
|
90
|
+
button: event.button,
|
|
91
|
+
buttons: event.buttons,
|
|
92
|
+
relatedTarget: event.relatedTarget
|
|
93
|
+
});
|
|
94
|
+
targetLink.dispatchEvent(mouseEvent);
|
|
95
|
+
event.preventDefault();
|
|
96
|
+
} else {
|
|
97
|
+
url = item.querySelector(".object_link a").getAttribute("href");
|
|
98
|
+
try {
|
|
99
|
+
url = new URL(url, window.location.href).href;
|
|
100
|
+
} catch (error) {}
|
|
101
|
+
window.top.postMessage({ action: "navigate", url: url }, "*");
|
|
102
|
+
}
|
|
103
|
+
return false;
|
|
104
|
+
});
|
|
64
105
|
});
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
function toggleItem(toggle) {
|
|
109
|
+
var item = toggle.parentElement.parentElement;
|
|
110
|
+
var expanded = item.classList.contains("collapsed");
|
|
111
|
+
|
|
112
|
+
item.classList.toggle("collapsed");
|
|
113
|
+
toggle.setAttribute("aria-expanded", expanded ? "true" : "false");
|
|
65
114
|
highlight();
|
|
66
|
-
}
|
|
115
|
+
}
|
|
67
116
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
$(this).parent().parent().toggleClass('collapsed');
|
|
75
|
-
$(this).attr('aria-expanded', function (i, attr) {
|
|
76
|
-
return attr == 'true' ? 'false' : 'true'
|
|
117
|
+
function enableToggles() {
|
|
118
|
+
queryAll("#full_list a.toggle").forEach(function(toggle) {
|
|
119
|
+
toggle.addEventListener("click", function(event) {
|
|
120
|
+
event.stopPropagation();
|
|
121
|
+
event.preventDefault();
|
|
122
|
+
toggleItem(toggle);
|
|
77
123
|
});
|
|
78
|
-
highlight();
|
|
79
|
-
}
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
124
|
|
|
83
|
-
function
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
125
|
+
toggle.addEventListener("keypress", function(event) {
|
|
126
|
+
if (event.key !== "Enter") return;
|
|
127
|
+
event.stopPropagation();
|
|
128
|
+
event.preventDefault();
|
|
129
|
+
toggleItem(toggle);
|
|
130
|
+
});
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
function populateSearchCache() {
|
|
135
|
+
queryAll("#full_list li .item").forEach(function(node) {
|
|
136
|
+
var link = query(".object_link a", node);
|
|
137
|
+
if (!link) return;
|
|
138
|
+
|
|
88
139
|
searchCache.push({
|
|
89
|
-
node:
|
|
90
|
-
link:
|
|
91
|
-
name:
|
|
92
|
-
fullName:
|
|
140
|
+
node: node,
|
|
141
|
+
link: link,
|
|
142
|
+
name: link.textContent,
|
|
143
|
+
fullName: link.getAttribute("title").split(" ")[0]
|
|
93
144
|
});
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
function enableSearch() {
|
|
149
|
+
var input = query("#search input");
|
|
150
|
+
var fullList = query("#full_list");
|
|
151
|
+
|
|
152
|
+
if (!input || !fullList) return;
|
|
153
|
+
|
|
154
|
+
input.addEventListener("keyup", function(event) {
|
|
155
|
+
if (ignoredKeyPress(event)) return;
|
|
156
|
+
if (input.value === "") {
|
|
157
|
+
clearSearch();
|
|
158
|
+
} else {
|
|
159
|
+
performSearch(input.value);
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
fullList.insertAdjacentHTML(
|
|
164
|
+
"afterend",
|
|
165
|
+
"<div id='noresults' role='status' style='display: none'></div>"
|
|
166
|
+
);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
function ignoredKeyPress(event) {
|
|
170
|
+
return (
|
|
171
|
+
(event.keyCode > ignoreKeyCodeMin && event.keyCode < ignoreKeyCodeMax) ||
|
|
172
|
+
event.keyCode === commandKey
|
|
173
|
+
);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
function clearSearch() {
|
|
177
|
+
clearSearchTimeout();
|
|
178
|
+
queryAll("#full_list .found").forEach(function(node) {
|
|
179
|
+
var link = query(".object_link a", node);
|
|
180
|
+
node.classList.remove("found");
|
|
181
|
+
link.textContent = link.textContent;
|
|
182
|
+
});
|
|
183
|
+
query("#full_list").classList.remove("insearch");
|
|
184
|
+
query("#content").classList.remove("insearch");
|
|
185
|
+
if (clicked) {
|
|
186
|
+
var current = clicked.parentElement;
|
|
187
|
+
while (current) {
|
|
188
|
+
if (current.tagName === "LI") current.classList.remove("collapsed");
|
|
189
|
+
if (current.id === "full_list") break;
|
|
190
|
+
current = current.parentElement;
|
|
191
|
+
}
|
|
94
192
|
}
|
|
95
|
-
|
|
96
|
-
}
|
|
193
|
+
highlight();
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
function performSearch(searchString) {
|
|
197
|
+
clearSearchTimeout();
|
|
198
|
+
query("#full_list").classList.add("insearch");
|
|
199
|
+
query("#content").classList.add("insearch");
|
|
200
|
+
query("#noresults").textContent = "";
|
|
201
|
+
query("#noresults").style.display = "none";
|
|
202
|
+
partialSearch(searchString, 0);
|
|
203
|
+
}
|
|
97
204
|
|
|
98
|
-
function
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
205
|
+
function partialSearch(searchString, offset) {
|
|
206
|
+
var lastRowClass = "";
|
|
207
|
+
var i;
|
|
208
|
+
|
|
209
|
+
for (i = offset; i < Math.min(offset + 50, searchCache.length); i += 1) {
|
|
210
|
+
var item = searchCache[i];
|
|
211
|
+
var searchName =
|
|
212
|
+
searchString.indexOf("::") !== -1 ? item.fullName : item.name;
|
|
213
|
+
var matchRegexp = new RegExp(
|
|
214
|
+
buildMatchString(searchString),
|
|
215
|
+
caseSensitiveMatch ? "" : "i"
|
|
216
|
+
);
|
|
217
|
+
|
|
218
|
+
if (!searchName.match(matchRegexp)) {
|
|
219
|
+
item.node.classList.remove("found");
|
|
220
|
+
item.link.textContent = item.link.textContent;
|
|
221
|
+
} else {
|
|
222
|
+
item.node.classList.add("found");
|
|
223
|
+
if (lastRowClass) item.node.classList.remove(lastRowClass);
|
|
224
|
+
item.node.classList.add(lastRowClass === "r1" ? "r2" : "r1");
|
|
225
|
+
lastRowClass = item.node.classList.contains("r1") ? "r1" : "r2";
|
|
226
|
+
item.link.innerHTML = item.name.replace(matchRegexp, "<strong>$&</strong>");
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
if (i === searchCache.length) {
|
|
231
|
+
searchDone();
|
|
103
232
|
} else {
|
|
104
|
-
|
|
233
|
+
searchTimeout = setTimeout(function() {
|
|
234
|
+
partialSearch(searchString, i);
|
|
235
|
+
}, 0);
|
|
105
236
|
}
|
|
106
|
-
}
|
|
237
|
+
}
|
|
107
238
|
|
|
108
|
-
|
|
109
|
-
|
|
239
|
+
function searchDone() {
|
|
240
|
+
var found = queryAll("#full_list li").filter(isVisible).length;
|
|
110
241
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
(event.keyCode > ignoreKeyCodeMin && event.keyCode < ignoreKeyCodeMax) ||
|
|
114
|
-
(event.keyCode == commandKey)
|
|
115
|
-
) {
|
|
116
|
-
return true;
|
|
117
|
-
} else {
|
|
118
|
-
return false;
|
|
119
|
-
}
|
|
120
|
-
}
|
|
242
|
+
searchTimeout = null;
|
|
243
|
+
highlight();
|
|
121
244
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
$link.text($link.text());
|
|
127
|
-
});
|
|
128
|
-
$('#full_list, #content').removeClass('insearch');
|
|
129
|
-
$clicked.parents().removeClass('collapsed');
|
|
130
|
-
highlight();
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
function performSearch(searchString) {
|
|
134
|
-
clearSearchTimeout();
|
|
135
|
-
$('#full_list, #content').addClass('insearch');
|
|
136
|
-
$('#noresults').text('').hide();
|
|
137
|
-
partialSearch(searchString, 0);
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
function partialSearch(searchString, offset) {
|
|
141
|
-
var lastRowClass = '';
|
|
142
|
-
var i = null;
|
|
143
|
-
for (i = offset; i < Math.min(offset + 50, searchCache.length); i++) {
|
|
144
|
-
var item = searchCache[i];
|
|
145
|
-
var searchName = (searchString.indexOf('::') != -1 ? item.fullName : item.name);
|
|
146
|
-
var matchString = buildMatchString(searchString);
|
|
147
|
-
var matchRegexp = new RegExp(matchString, caseSensitiveMatch ? "" : "i");
|
|
148
|
-
if (searchName.match(matchRegexp) == null) {
|
|
149
|
-
item.node.removeClass('found');
|
|
150
|
-
item.link.text(item.link.text());
|
|
245
|
+
if (found === 0) {
|
|
246
|
+
query("#noresults").textContent = "No results were found.";
|
|
247
|
+
} else {
|
|
248
|
+
query("#noresults").textContent = "There are " + found + " results.";
|
|
151
249
|
}
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
250
|
+
query("#noresults").style.display = "block";
|
|
251
|
+
query("#content").classList.remove("insearch");
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
function buildMatchString(searchString) {
|
|
255
|
+
var regexSearchString;
|
|
256
|
+
|
|
257
|
+
caseSensitiveMatch = /[A-Z]/.test(searchString);
|
|
258
|
+
regexSearchString = RegExp.escape(searchString);
|
|
259
|
+
if (caseSensitiveMatch) {
|
|
260
|
+
regexSearchString +=
|
|
261
|
+
"|" +
|
|
262
|
+
searchString
|
|
263
|
+
.split("")
|
|
264
|
+
.map(function(character) {
|
|
265
|
+
return RegExp.escape(character);
|
|
266
|
+
})
|
|
267
|
+
.join(".+?");
|
|
157
268
|
}
|
|
269
|
+
return regexSearchString;
|
|
158
270
|
}
|
|
159
|
-
if(i == searchCache.length) {
|
|
160
|
-
searchDone();
|
|
161
|
-
} else {
|
|
162
|
-
searchTimeout = setTimeout(function() {
|
|
163
|
-
partialSearch(searchString, i);
|
|
164
|
-
}, 0);
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
function searchDone() {
|
|
169
|
-
searchTimeout = null;
|
|
170
|
-
highlight();
|
|
171
|
-
var found = $('#full_list li:visible').size();
|
|
172
|
-
if (found === 0) {
|
|
173
|
-
$('#noresults').text('No results were found.');
|
|
174
|
-
} else {
|
|
175
|
-
// This is read out to screen readers
|
|
176
|
-
$('#noresults').text('There are ' + found + ' results.');
|
|
177
|
-
}
|
|
178
|
-
$('#noresults').show();
|
|
179
|
-
$('#content').removeClass('insearch');
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
function buildMatchString(searchString, event) {
|
|
183
|
-
caseSensitiveMatch = searchString.match(/[A-Z]/) != null;
|
|
184
|
-
var regexSearchString = RegExp.escape(searchString);
|
|
185
|
-
if (caseSensitiveMatch) {
|
|
186
|
-
regexSearchString += "|" +
|
|
187
|
-
$.map(searchString.split(''), function(e) { return RegExp.escape(e); }).
|
|
188
|
-
join('.+?');
|
|
189
|
-
}
|
|
190
|
-
return regexSearchString;
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
function highlight() {
|
|
194
|
-
$('#full_list li:visible').each(function(n) {
|
|
195
|
-
$(this).removeClass('even odd').addClass(n % 2 == 0 ? 'odd' : 'even');
|
|
196
|
-
});
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
function isInView(element) {
|
|
200
|
-
const rect = element.getBoundingClientRect();
|
|
201
|
-
const windowHeight =
|
|
202
|
-
window.innerHeight || document.documentElement.clientHeight;
|
|
203
|
-
return rect.left >= 0 && rect.bottom <= windowHeight;
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
/**
|
|
207
|
-
* Expands the tree to the target element and its immediate
|
|
208
|
-
* children.
|
|
209
|
-
*/
|
|
210
|
-
function expandTo(path) {
|
|
211
|
-
var $target = $(document.getElementById('object_' + path));
|
|
212
|
-
$target.addClass('clicked');
|
|
213
|
-
$target.removeClass('collapsed');
|
|
214
|
-
$target.parentsUntil('#full_list', 'li').removeClass('collapsed');
|
|
215
|
-
|
|
216
|
-
$target.find('a.toggle').attr('aria-expanded', 'true')
|
|
217
|
-
$target.parentsUntil('#full_list', 'li').each(function(i, el) {
|
|
218
|
-
$(el).find('> div > a.toggle').attr('aria-expanded', 'true');
|
|
219
|
-
});
|
|
220
271
|
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
272
|
+
function highlight() {
|
|
273
|
+
queryAll("#full_list li")
|
|
274
|
+
.filter(isVisible)
|
|
275
|
+
.forEach(function(item, index) {
|
|
276
|
+
item.classList.remove("even");
|
|
277
|
+
item.classList.remove("odd");
|
|
278
|
+
item.classList.add(index % 2 === 0 ? "odd" : "even");
|
|
279
|
+
});
|
|
224
280
|
}
|
|
225
|
-
}
|
|
226
281
|
|
|
227
|
-
function
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
282
|
+
function isInView(element) {
|
|
283
|
+
var rect = element.getBoundingClientRect();
|
|
284
|
+
var windowHeight =
|
|
285
|
+
window.innerHeight || document.documentElement.clientHeight;
|
|
286
|
+
return rect.left >= 0 && rect.bottom <= windowHeight;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
function expandTo(path) {
|
|
290
|
+
var target = document.getElementById("object_" + path);
|
|
291
|
+
|
|
292
|
+
if (!target) return;
|
|
293
|
+
|
|
294
|
+
target.classList.add("clicked");
|
|
295
|
+
target.classList.remove("collapsed");
|
|
296
|
+
|
|
297
|
+
var current = target.parentElement;
|
|
298
|
+
while (current && current.id !== "full_list") {
|
|
299
|
+
if (current.tagName === "LI") current.classList.remove("collapsed");
|
|
300
|
+
current = current.parentElement;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
queryAll("a.toggle", target).forEach(function(toggle) {
|
|
304
|
+
toggle.setAttribute("aria-expanded", "true");
|
|
305
|
+
});
|
|
306
|
+
|
|
307
|
+
current = target.parentElement;
|
|
308
|
+
while (current && current.id !== "full_list") {
|
|
309
|
+
if (current.tagName === "LI") {
|
|
310
|
+
var toggle = current.querySelector(":scope > div > a.toggle");
|
|
311
|
+
if (toggle) toggle.setAttribute("aria-expanded", "true");
|
|
312
|
+
}
|
|
313
|
+
current = current.parentElement;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
if (!isInView(target)) {
|
|
317
|
+
window.scrollTo(
|
|
318
|
+
window.scrollX,
|
|
319
|
+
target.getBoundingClientRect().top + window.scrollY - 250
|
|
320
|
+
);
|
|
321
|
+
highlight();
|
|
322
|
+
}
|
|
231
323
|
}
|
|
232
|
-
return false;
|
|
233
|
-
}
|
|
234
324
|
|
|
235
|
-
|
|
325
|
+
function windowEvents(event) {
|
|
326
|
+
var msg = event.data;
|
|
327
|
+
if (msg.action === "expand") {
|
|
328
|
+
expandTo(msg.path);
|
|
329
|
+
}
|
|
330
|
+
return false;
|
|
331
|
+
}
|
|
236
332
|
|
|
237
|
-
|
|
238
|
-
escapeShortcut();
|
|
239
|
-
enableLinks();
|
|
240
|
-
enableToggles();
|
|
241
|
-
populateSearchCache();
|
|
242
|
-
enableSearch();
|
|
243
|
-
});
|
|
333
|
+
window.addEventListener("message", windowEvents, false);
|
|
244
334
|
|
|
335
|
+
ready(function() {
|
|
336
|
+
escapeShortcut();
|
|
337
|
+
enableLinks();
|
|
338
|
+
enableToggles();
|
|
339
|
+
populateSearchCache();
|
|
340
|
+
enableSearch();
|
|
341
|
+
});
|
|
245
342
|
})();
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
<% end %>
|
|
8
8
|
</title>
|
|
9
9
|
<% stylesheets.each do |stylesheet| %>
|
|
10
|
-
<link rel="stylesheet" href="<%= mtime_url(stylesheet) %>" type="text/css"
|
|
10
|
+
<link rel="stylesheet" href="<%= mtime_url(stylesheet) %>" type="text/css">
|
|
11
11
|
<% end %>
|
|
12
12
|
<%= erb :script_setup %>
|
|
13
13
|
<% javascripts.each do |javascript| %>
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
<dl>
|
|
4
4
|
<dt class="">Defined in:</dt>
|
|
5
5
|
<dd class="">
|
|
6
|
-
<%= object.file %><% if object.files.size > 1 %><span class="defines">,<br
|
|
7
|
-
<%= object.files[1..-1].map {|f| f.first }.join(",<br
|
|
6
|
+
<%= object.file %><% if object.files.size > 1 %><span class="defines">,<br>
|
|
7
|
+
<%= object.files[1..-1].map {|f| f.first }.join(",<br> ") %></div>
|
|
8
8
|
<% end %>
|
|
9
9
|
</dd>
|
|
10
10
|
</dl>
|
|
@@ -14,4 +14,4 @@
|
|
|
14
14
|
<div id="method_details">
|
|
15
15
|
<%= yieldall :index => 0 %>
|
|
16
16
|
</div>
|
|
17
|
-
</div>
|
|
17
|
+
</div>
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
<%= object.file ? object.file : '(unknown)' %><% if object.files.size > 1 %><span class="defines">,<br
|
|
2
|
-
<%= object.files[1..-1].map {|f| f.first }.join(",<br
|
|
3
|
-
<% end %>
|
|
1
|
+
<%= object.file ? object.file : '(unknown)' %><% if object.files.size > 1 %><span class="defines">,<br>
|
|
2
|
+
<%= object.files[1..-1].map {|f| f.first }.join(",<br> ") %></span>
|
|
3
|
+
<% end %>
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
<% meths = prune_method_listing(superclass.meths(:included => false, :inherited => false)) %>
|
|
6
6
|
<% meths.reject! {|m| object.child(:scope => m.scope, :name => m.name) != nil } %>
|
|
7
7
|
<% meths.reject! {|m| m.is_alias? || m.is_attribute? } %>
|
|
8
|
+
<% meths.reject! {|m| m.group && object.groups && object.groups.include?(m.group) } %>
|
|
8
9
|
<% next if meths.size == 0 %>
|
|
9
10
|
<% if method_listing.size == 0 && !found_method %><h2>Method Summary</h2><% end %>
|
|
10
11
|
<% found_method = true %>
|
|
@@ -10,5 +10,13 @@
|
|
|
10
10
|
<%= yieldall :item => meth %>
|
|
11
11
|
<% end %>
|
|
12
12
|
</ul>
|
|
13
|
+
<% (inherited_methods_by_group[name] || {}).each do |superclass, meths| %>
|
|
14
|
+
<h3 class="inherited">Methods <%= superclass.type == :class ? 'inherited' : 'included' %> from <%= linkify superclass %></h3>
|
|
15
|
+
<p class="inherited"><%= meths.sort_by {|o| o.name.to_s }.map {|m|
|
|
16
|
+
mname = m.name(true)
|
|
17
|
+
mname = mname.gsub(/^#/, '') if superclass.type == :module && object.class_mixins.include?(superclass)
|
|
18
|
+
linkify(m, mname)
|
|
19
|
+
}.join(", ") %></p>
|
|
20
|
+
<% end %>
|
|
13
21
|
<% end %>
|
|
14
22
|
<% end %>
|
|
@@ -104,6 +104,26 @@ def inherited_constant_list
|
|
|
104
104
|
end
|
|
105
105
|
end
|
|
106
106
|
|
|
107
|
+
def inherited_methods_by_group
|
|
108
|
+
return @inherited_meths_by_group if defined?(@inherited_meths_by_group)
|
|
109
|
+
@inherited_meths_by_group = {}
|
|
110
|
+
return @inherited_meths_by_group unless object.groups
|
|
111
|
+
|
|
112
|
+
object.inheritance_tree(true)[1..-1].each do |superclass|
|
|
113
|
+
next if superclass.is_a?(YARD::CodeObjects::Proxy)
|
|
114
|
+
next if options.embed_mixins.size > 0 && options.embed_mixins_match?(superclass) != false
|
|
115
|
+
meths = prune_method_listing(superclass.meths(:included => false, :inherited => false))
|
|
116
|
+
meths.reject! {|m| object.child(:scope => m.scope, :name => m.name) != nil }
|
|
117
|
+
meths.reject! {|m| m.is_alias? || m.is_attribute? }
|
|
118
|
+
meths.each do |m|
|
|
119
|
+
next unless m.group && object.groups.include?(m.group)
|
|
120
|
+
(@inherited_meths_by_group[m.group] ||= {})[superclass] ||= []
|
|
121
|
+
@inherited_meths_by_group[m.group][superclass] << m
|
|
122
|
+
end
|
|
123
|
+
end
|
|
124
|
+
@inherited_meths_by_group
|
|
125
|
+
end
|
|
126
|
+
|
|
107
127
|
def docstring_full(obj)
|
|
108
128
|
docstring = obj.tags(:overload).size == 1 && obj.docstring.empty? ?
|
|
109
129
|
obj.tag(:overload).docstring : obj.docstring
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
<!DOCTYPE html
|
|
2
|
-
|
|
3
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
4
3
|
<head>
|
|
5
|
-
<meta
|
|
4
|
+
<meta charset="<%= charset %>">
|
|
6
5
|
<title><%= defined?(@title) ? @title : '' %></title>
|
|
7
6
|
<%= erb(:headers) %>
|
|
8
7
|
</head>
|