forked from rubygems/guides
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclasspage.rhtml
80 lines (68 loc) · 2.17 KB
/
classpage.rhtml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
---
layout: default
title: Specification Reference
url: /specification-reference
previous: /patterns
next: /command-reference
---
<% description = klass.description
description.gsub! %r%<a\shref=(["'])Specification\.html#.*?\1>(.*?)</a>%m, '\2'
description.gsub! %r%<a\shref=(["'])Specification\.html\1><code>Specification</code></a>%,
'Specification' %>
<%= description -%>
<%
sections = {}
klass.each_section do |section, constants, attributes|
sections[section] = attributes if section.title =~ /attributes/
end
all_methods = {}
sections.to_a.reverse.each do |section, attributes|
all_methods[section] = {}
attributes.each do |attrib|
all_methods[section][attrib.name] = attrib
end
klass.methods_by_type(section).each do |type, visibilities|
visibilities.each do |visibility, methods|
methods.each do |method|
all_methods[section][method.name] = method
method.aliases.each { |aka| all_methods[section][aka.name] = aka }
end
end
end
end
-%>
<% all_methods.each do |section, methods| %>
## <%= section.title %>
<% methods.sort_by(&:first).each do |name, method| %>
* [<%= name %>](#<%= name %>)
<% end -%>
<% end %>
<% all_methods.each do |section, methods| -%>
# <%= section.title %>
<% methods.sort_by(&:first).each do |name, method|
params =
if method.params then
params = method.params.delete '()'
if params.empty? then
''
else
params = params.split(',').map { |param| "`#{param.strip}`" }.join ', '
"(#{params})"
end
end
-%>
<a id="<%= name %>"> </a>
## <%= name %><%= params %>
<% description = method.description.strip
description.gsub! %r%<a\shref=(["'])Specification\.html#.*?\1>(.*?)</a>%m, '\2'
description.gsub! %r%<a\shref=(["'])Specification\.html\1>Specification</a>%,
'Specification' %>
<%= description %>
<% if method.aliases.any? -%>
Also aliased as: <%= method.aliases.map { |aka| "[#{aka.name}](##{aka.name})" }.join ", " %>
<% elsif method.is_alias_for -%>
Alias for: [<%= method.is_alias_for.name %>](#<%= method.is_alias_for.name %>)
<% end -%>
<% end -%>
<% end -%>
<!--<html -->