pdoc 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +34 -0
- data/Rakefile +46 -0
- data/bin/pdoc +58 -0
- data/lib/pdoc.rb +32 -0
- data/lib/pdoc/error.rb +4 -0
- data/lib/pdoc/generators.rb +6 -0
- data/lib/pdoc/generators/abstract_generator.rb +16 -0
- data/lib/pdoc/generators/html.rb +8 -0
- data/lib/pdoc/generators/html/helpers.rb +256 -0
- data/lib/pdoc/generators/html/page.rb +71 -0
- data/lib/pdoc/generators/html/syntax_highlighter.rb +41 -0
- data/lib/pdoc/generators/html/template.rb +37 -0
- data/lib/pdoc/generators/html/website.rb +194 -0
- data/lib/pdoc/generators/json.rb +15 -0
- data/lib/pdoc/generators/pythonesque.rb +105 -0
- data/lib/pdoc/models.rb +47 -0
- data/lib/pdoc/models/argument.rb +37 -0
- data/lib/pdoc/models/base.rb +107 -0
- data/lib/pdoc/models/callable.rb +19 -0
- data/lib/pdoc/models/class.rb +28 -0
- data/lib/pdoc/models/class_method.rb +18 -0
- data/lib/pdoc/models/class_property.rb +9 -0
- data/lib/pdoc/models/constant.rb +9 -0
- data/lib/pdoc/models/constructor.rb +14 -0
- data/lib/pdoc/models/container.rb +114 -0
- data/lib/pdoc/models/entity.rb +54 -0
- data/lib/pdoc/models/instance_method.rb +18 -0
- data/lib/pdoc/models/instance_property.rb +9 -0
- data/lib/pdoc/models/mixin.rb +10 -0
- data/lib/pdoc/models/namespace.rb +10 -0
- data/lib/pdoc/models/root.rb +27 -0
- data/lib/pdoc/models/section.rb +19 -0
- data/lib/pdoc/models/signature.rb +27 -0
- data/lib/pdoc/models/utility.rb +11 -0
- data/lib/pdoc/parser.rb +109 -0
- data/lib/pdoc/parser/argument_description_nodes.rb +21 -0
- data/lib/pdoc/parser/basic_nodes.rb +31 -0
- data/lib/pdoc/parser/description_nodes.rb +42 -0
- data/lib/pdoc/parser/documentation_nodes.rb +483 -0
- data/lib/pdoc/parser/ebnf_arguments_nodes.rb +58 -0
- data/lib/pdoc/parser/ebnf_expression_nodes.rb +227 -0
- data/lib/pdoc/parser/fragment.rb +55 -0
- data/lib/pdoc/parser/section_content_nodes.rb +19 -0
- data/lib/pdoc/parser/tags_nodes.rb +14 -0
- data/lib/pdoc/parser/treetop_files/argument_description.treetop +31 -0
- data/lib/pdoc/parser/treetop_files/basic.treetop +41 -0
- data/lib/pdoc/parser/treetop_files/description.treetop +7 -0
- data/lib/pdoc/parser/treetop_files/documentation.treetop +75 -0
- data/lib/pdoc/parser/treetop_files/ebnf_arguments.treetop +33 -0
- data/lib/pdoc/parser/treetop_files/ebnf_expression.treetop +70 -0
- data/lib/pdoc/parser/treetop_files/ebnf_javascript.treetop +54 -0
- data/lib/pdoc/parser/treetop_files/events.treetop +17 -0
- data/lib/pdoc/parser/treetop_files/section_content.treetop +8 -0
- data/lib/pdoc/parser/treetop_files/tags.treetop +31 -0
- data/lib/pdoc/runner.rb +110 -0
- data/lib/pdoc/treemaker.rb +94 -0
- data/pdoc.gemspec +31 -0
- data/templates/html/assets/images/pdoc/alias.png +0 -0
- data/templates/html/assets/images/pdoc/class.png +0 -0
- data/templates/html/assets/images/pdoc/class_deprecated.png +0 -0
- data/templates/html/assets/images/pdoc/class_method.png +0 -0
- data/templates/html/assets/images/pdoc/class_property.png +0 -0
- data/templates/html/assets/images/pdoc/constant.png +0 -0
- data/templates/html/assets/images/pdoc/constructor.png +0 -0
- data/templates/html/assets/images/pdoc/deprecated.png +0 -0
- data/templates/html/assets/images/pdoc/description.png +0 -0
- data/templates/html/assets/images/pdoc/information.png +0 -0
- data/templates/html/assets/images/pdoc/instance_method.png +0 -0
- data/templates/html/assets/images/pdoc/instance_property.png +0 -0
- data/templates/html/assets/images/pdoc/method.png +0 -0
- data/templates/html/assets/images/pdoc/method_deprecated.png +0 -0
- data/templates/html/assets/images/pdoc/mixin.png +0 -0
- data/templates/html/assets/images/pdoc/namespace.png +0 -0
- data/templates/html/assets/images/pdoc/property.png +0 -0
- data/templates/html/assets/images/pdoc/related_to.png +0 -0
- data/templates/html/assets/images/pdoc/search-background.png +0 -0
- data/templates/html/assets/images/pdoc/section-background.png +0 -0
- data/templates/html/assets/images/pdoc/section.png +0 -0
- data/templates/html/assets/images/pdoc/selected-section-background.png +0 -0
- data/templates/html/assets/images/pdoc/subclass.png +0 -0
- data/templates/html/assets/images/pdoc/superclass.png +0 -0
- data/templates/html/assets/images/pdoc/utility.png +0 -0
- data/templates/html/assets/javascripts/pdoc/application.js +478 -0
- data/templates/html/assets/javascripts/pdoc/prototype.js +4874 -0
- data/templates/html/assets/javascripts/pdoc/tabs.js +506 -0
- data/templates/html/assets/stylesheets/pdoc/api.css +677 -0
- data/templates/html/assets/stylesheets/pdoc/pygments.css +62 -0
- data/templates/html/helpers.rb +35 -0
- data/templates/html/index.erb +18 -0
- data/templates/html/item_index.js.erb +6 -0
- data/templates/html/layout.erb +67 -0
- data/templates/html/leaf.erb +22 -0
- data/templates/html/node.erb +30 -0
- data/templates/html/partials/class_relationships.erb +19 -0
- data/templates/html/partials/classes.erb +7 -0
- data/templates/html/partials/constructor.erb +5 -0
- data/templates/html/partials/description.erb +5 -0
- data/templates/html/partials/link_list.erb +1 -0
- data/templates/html/partials/method_signatures.erb +14 -0
- data/templates/html/partials/methodized_note.erb +9 -0
- data/templates/html/partials/mixins.erb +7 -0
- data/templates/html/partials/namespaces.erb +7 -0
- data/templates/html/partials/related_utilities.erb +5 -0
- data/templates/html/partials/relationships.erb +11 -0
- data/templates/html/partials/short_description_list.erb +7 -0
- data/templates/html/partials/title.erb +22 -0
- data/templates/html/section.erb +18 -0
- data/test/unit/parser/argument_description_test.rb +40 -0
- data/test/unit/parser/basic_test.rb +55 -0
- data/test/unit/parser/description_test.rb +34 -0
- data/test/unit/parser/documentation_test.rb +520 -0
- data/test/unit/parser/ebnf_arguments_test.rb +81 -0
- data/test/unit/parser/ebnf_expression_test.rb +382 -0
- data/test/unit/parser/ebnf_javascript_test.rb +37 -0
- data/test/unit/parser/events_test.rb +27 -0
- data/test/unit/parser/section_content_test.rb +44 -0
- data/test/unit/parser/tags_test.rb +39 -0
- data/test/unit/parser/test_fragment.rb +80 -0
- data/test/unit/parser_test_helper.rb +62 -0
- data/test/unit/runner/basic_test.rb +14 -0
- data/test/unit/templates/html_helpers_test.rb +25 -0
- metadata +222 -0
@@ -0,0 +1,62 @@
|
|
1
|
+
.highlight .hll { background-color: #ffffcc }
|
2
|
+
.highlight { background: #f8f8f8; }
|
3
|
+
.highlight .c { color: #408080; font-style: italic } /* Comment */
|
4
|
+
.highlight .err { border: 1px solid #FF0000 } /* Error */
|
5
|
+
.highlight .k { color: #008000; font-weight: bold } /* Keyword */
|
6
|
+
.highlight .o { color: #666666 } /* Operator */
|
7
|
+
.highlight .cm { color: #408080; font-style: italic } /* Comment.Multiline */
|
8
|
+
.highlight .cp { color: #BC7A00 } /* Comment.Preproc */
|
9
|
+
.highlight .c1 { color: #408080; font-style: italic } /* Comment.Single */
|
10
|
+
.highlight .cs { color: #408080; font-style: italic } /* Comment.Special */
|
11
|
+
.highlight .gd { color: #A00000 } /* Generic.Deleted */
|
12
|
+
.highlight .ge { font-style: italic } /* Generic.Emph */
|
13
|
+
.highlight .gr { color: #FF0000 } /* Generic.Error */
|
14
|
+
.highlight .gh { color: #000080; font-weight: bold } /* Generic.Heading */
|
15
|
+
.highlight .gi { color: #00A000 } /* Generic.Inserted */
|
16
|
+
.highlight .go { color: #808080 } /* Generic.Output */
|
17
|
+
.highlight .gp { color: #000080; font-weight: bold } /* Generic.Prompt */
|
18
|
+
.highlight .gs { font-weight: bold } /* Generic.Strong */
|
19
|
+
.highlight .gu { color: #800080; font-weight: bold } /* Generic.Subheading */
|
20
|
+
.highlight .gt { color: #0040D0 } /* Generic.Traceback */
|
21
|
+
.highlight .kc { color: #008000; font-weight: bold } /* Keyword.Constant */
|
22
|
+
.highlight .kd { color: #008000; font-weight: bold } /* Keyword.Declaration */
|
23
|
+
.highlight .kn { color: #008000; font-weight: bold } /* Keyword.Namespace */
|
24
|
+
.highlight .kp { color: #008000 } /* Keyword.Pseudo */
|
25
|
+
.highlight .kr { color: #008000; font-weight: bold } /* Keyword.Reserved */
|
26
|
+
.highlight .kt { color: #B00040 } /* Keyword.Type */
|
27
|
+
.highlight .m { color: #666666 } /* Literal.Number */
|
28
|
+
.highlight .s { color: #BA2121 } /* Literal.String */
|
29
|
+
.highlight .na { color: #7D9029 } /* Name.Attribute */
|
30
|
+
.highlight .nb { color: #008000 } /* Name.Builtin */
|
31
|
+
.highlight .nc { color: #0000FF; font-weight: bold } /* Name.Class */
|
32
|
+
.highlight .no { color: #880000 } /* Name.Constant */
|
33
|
+
.highlight .nd { color: #AA22FF } /* Name.Decorator */
|
34
|
+
.highlight .ni { color: #999999; font-weight: bold } /* Name.Entity */
|
35
|
+
.highlight .ne { color: #D2413A; font-weight: bold } /* Name.Exception */
|
36
|
+
.highlight .nf { color: #0000FF } /* Name.Function */
|
37
|
+
.highlight .nl { color: #A0A000 } /* Name.Label */
|
38
|
+
.highlight .nn { color: #0000FF; font-weight: bold } /* Name.Namespace */
|
39
|
+
.highlight .nt { color: #008000; font-weight: bold } /* Name.Tag */
|
40
|
+
.highlight .nv { color: #19177C } /* Name.Variable */
|
41
|
+
.highlight .ow { color: #AA22FF; font-weight: bold } /* Operator.Word */
|
42
|
+
.highlight .w { color: #bbbbbb } /* Text.Whitespace */
|
43
|
+
.highlight .mf { color: #666666 } /* Literal.Number.Float */
|
44
|
+
.highlight .mh { color: #666666 } /* Literal.Number.Hex */
|
45
|
+
.highlight .mi { color: #666666 } /* Literal.Number.Integer */
|
46
|
+
.highlight .mo { color: #666666 } /* Literal.Number.Oct */
|
47
|
+
.highlight .sb { color: #BA2121 } /* Literal.String.Backtick */
|
48
|
+
.highlight .sc { color: #BA2121 } /* Literal.String.Char */
|
49
|
+
.highlight .sd { color: #BA2121; font-style: italic } /* Literal.String.Doc */
|
50
|
+
.highlight .s2 { color: #BA2121 } /* Literal.String.Double */
|
51
|
+
.highlight .se { color: #BB6622; font-weight: bold } /* Literal.String.Escape */
|
52
|
+
.highlight .sh { color: #BA2121 } /* Literal.String.Heredoc */
|
53
|
+
.highlight .si { color: #BB6688; font-weight: bold } /* Literal.String.Interpol */
|
54
|
+
.highlight .sx { color: #008000 } /* Literal.String.Other */
|
55
|
+
.highlight .sr { color: #BB6688 } /* Literal.String.Regex */
|
56
|
+
.highlight .s1 { color: #BA2121 } /* Literal.String.Single */
|
57
|
+
.highlight .ss { color: #19177C } /* Literal.String.Symbol */
|
58
|
+
.highlight .bp { color: #008000 } /* Name.Builtin.Pseudo */
|
59
|
+
.highlight .vc { color: #19177C } /* Name.Variable.Class */
|
60
|
+
.highlight .vg { color: #19177C } /* Name.Variable.Global */
|
61
|
+
.highlight .vi { color: #19177C } /* Name.Variable.Instance */
|
62
|
+
.highlight .il { color: #666666 } /* Literal.Number.Integer.Long */
|
@@ -0,0 +1,35 @@
|
|
1
|
+
module PDoc
|
2
|
+
module Generators
|
3
|
+
module Html
|
4
|
+
module Helpers
|
5
|
+
module BaseHelper
|
6
|
+
def layout_section(title, classname = title.downcase)
|
7
|
+
<<-EOS
|
8
|
+
<div class="section section-#{classname}">
|
9
|
+
<div class="section-title">
|
10
|
+
<h3>#{title}</h3>
|
11
|
+
</div> <!-- .section-title -->
|
12
|
+
<div class="section-content">
|
13
|
+
EOS
|
14
|
+
end
|
15
|
+
|
16
|
+
def end_layout_section
|
17
|
+
<<-EOS
|
18
|
+
</div> <!-- .section-content -->
|
19
|
+
</div> <!-- .section -->
|
20
|
+
EOS
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
module LinkHelper
|
25
|
+
end
|
26
|
+
|
27
|
+
module CodeHelper
|
28
|
+
end
|
29
|
+
|
30
|
+
module MenuHelper
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<% @title = "Home" %>
|
2
|
+
|
3
|
+
<div class="page-introduction">
|
4
|
+
<%= @index_page_content %>
|
5
|
+
</div> <!-- .section -->
|
6
|
+
|
7
|
+
<%= layout_section('Sections') %>
|
8
|
+
<ul class="section-list">
|
9
|
+
<% @root.sections.each do |section| %>
|
10
|
+
<li>
|
11
|
+
<h4>
|
12
|
+
<a href="<%= path_to(section) %>"><%= section.name %></a>
|
13
|
+
</h4>
|
14
|
+
<p><%= htmlize(section.short_description) %></p>
|
15
|
+
</li>
|
16
|
+
<% end %>
|
17
|
+
</ul>
|
18
|
+
<%= end_layout_section %>
|
@@ -0,0 +1,67 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
6
|
+
<title><%= @short_name %> v<%= @version %> API documentation | <%= @title %></title>
|
7
|
+
<meta name="generator" content="PDoc" />
|
8
|
+
|
9
|
+
<%= javascript_include_tag "pdoc/prototype" %>
|
10
|
+
<%= javascript_include_tag "pdoc/application", "pdoc/tabs" %>
|
11
|
+
<%= javascript_include_tag "pdoc/item_index" %>
|
12
|
+
|
13
|
+
<%= stylesheet_link_tag "pdoc/api", "pdoc/pygments" %>
|
14
|
+
|
15
|
+
<script type="text/javascript">
|
16
|
+
PDoc.pathPrefix = '<%= path_prefix %>';
|
17
|
+
</script>
|
18
|
+
</head>
|
19
|
+
<body>
|
20
|
+
|
21
|
+
<div id="sidebar">
|
22
|
+
<ul id="sidebar_tabs" class="sidebar-tabs">
|
23
|
+
<li>
|
24
|
+
<a href="#menu_pane">Menu</a>
|
25
|
+
</li>
|
26
|
+
<li>
|
27
|
+
<a href="#search_pane">Search</a>
|
28
|
+
</li>
|
29
|
+
</ul> <!-- .sidebar-tabs -->
|
30
|
+
|
31
|
+
<form class="search-ribbon">
|
32
|
+
<label>
|
33
|
+
<span class="hidden">Search</span>
|
34
|
+
<input type="text" id="search" size="20" title="Search" />
|
35
|
+
</label>
|
36
|
+
</form>
|
37
|
+
|
38
|
+
<div class="sidebar-pane scrollable" id="menu_pane">
|
39
|
+
<%= menu(@root) %><!--- #api_menu =-->
|
40
|
+
</div> <!-- .sidebar-pane -->
|
41
|
+
<div class="sidebar-pane" id="search_pane">
|
42
|
+
<ul id="search_results" class="search-results menu-items scrollable"></ul>
|
43
|
+
</div> <!-- .sidebar-pane -->
|
44
|
+
</div> <!-- #sidebar -->
|
45
|
+
|
46
|
+
<div id="page">
|
47
|
+
<%= @home ? @index_header : @header %>
|
48
|
+
|
49
|
+
<div id="main" class="page-content">
|
50
|
+
<%= @content_for_layout %>
|
51
|
+
</div> <!-- #main -->
|
52
|
+
|
53
|
+
<div id="footer">
|
54
|
+
<p><a href="<%= @home_url %>"><%= @name %></a> v<%= @version %> API documentation.</p>
|
55
|
+
<p>
|
56
|
+
<% if @timestamp %>
|
57
|
+
Last updated on <%= @timestamp.strftime('%B %d, %Y at %H:%M UTC') %>.
|
58
|
+
<% end %>
|
59
|
+
Generated by <a href="http://pdoc.org">PDoc</a>.
|
60
|
+
Uses <a href="http://famfamfam.com/lab/icons/silk/" title="famfamfam.com: Silk Icons">Silk Icons</a> and portions of <a href="http://github.com/280north/aristo/tree/master" title="280north's aristo at master - GitHub">Aristo</a>.
|
61
|
+
</p>
|
62
|
+
<%= @footer %>
|
63
|
+
</div> <!-- #footer -->
|
64
|
+
|
65
|
+
</div> <!-- #page -->
|
66
|
+
</body>
|
67
|
+
</html>
|
@@ -0,0 +1,22 @@
|
|
1
|
+
<% @title = "#{@doc_instance.full_name} #{@doc_instance.type}" %>
|
2
|
+
|
3
|
+
<%= include "partials/title", :object => @doc_instance %>
|
4
|
+
|
5
|
+
<div class="section">
|
6
|
+
<div class="section-title">
|
7
|
+
</div> <!-- .section-title -->
|
8
|
+
<div class="section-content">
|
9
|
+
<div class="method-description">
|
10
|
+
<% if @doc_instance.respond_to?(:signatures) %>
|
11
|
+
<%= include "partials/method_signatures", :object => @doc_instance %>
|
12
|
+
<% else %>
|
13
|
+
<pre class="syntax"><code class="ebnf"><%= @doc_instance.signature.name %> → <%= auto_link_types(@doc_instance.signature.return_value, :name => :long).join(' | ') %></code></pre>
|
14
|
+
<% end %>
|
15
|
+
|
16
|
+
<%= htmlize(@doc_instance.description) %>
|
17
|
+
|
18
|
+
<%= include "partials/relationships", :object => @doc_instance %>
|
19
|
+
<%= include "partials/methodized_note", :object => @doc_instance %>
|
20
|
+
</div>
|
21
|
+
</div> <!-- .section-content -->
|
22
|
+
</div> <!-- .section -->
|
@@ -0,0 +1,30 @@
|
|
1
|
+
<% d = @doc_instance %>
|
2
|
+
|
3
|
+
<%= include "partials/title", :object => @doc_instance %>
|
4
|
+
<%= include "partials/description", :object => @doc_instance %>
|
5
|
+
|
6
|
+
<%= include "partials/namespaces", :object => @doc_instance %>
|
7
|
+
<%= include "partials/classes", :object => @doc_instance %>
|
8
|
+
|
9
|
+
<%= include "partials/class_relationships", :object => @doc_instance %>
|
10
|
+
<%= include "partials/related_utilities", :object => @doc_instance %>
|
11
|
+
<%= include "partials/constructor", :object => @doc_instance %>
|
12
|
+
|
13
|
+
<%
|
14
|
+
types = [
|
15
|
+
[:class_methods, 'Class methods'],
|
16
|
+
[:class_properties, 'Class properties'],
|
17
|
+
[:instance_methods, 'Instance methods'],
|
18
|
+
[:instance_properties, 'Instance properties'],
|
19
|
+
[:constants, 'Constants']
|
20
|
+
].each do |a| %>
|
21
|
+
<% method, title = a %>
|
22
|
+
<% methods = @doc_instance.send(method) %>
|
23
|
+
<% unless methods.empty? %>
|
24
|
+
<%= layout_section(title, method) %>
|
25
|
+
<ul class="method-list">
|
26
|
+
<%= include "partials/link_list", :collection => methods.sort! %>
|
27
|
+
</ul>
|
28
|
+
<%= end_layout_section %>
|
29
|
+
<% end %>
|
30
|
+
<% end %>
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<% if object.is_a?(Models::Class) %>
|
2
|
+
<% if object.superclass %>
|
3
|
+
<%= layout_section('Superclass') %>
|
4
|
+
<p><%= auto_link_code(object.superclass, :name => :long) %></p>
|
5
|
+
<%= end_layout_section %>
|
6
|
+
<% end %>
|
7
|
+
|
8
|
+
<% if object.subclasses? %>
|
9
|
+
<%= layout_section('Subclasses') %>
|
10
|
+
<p><%= object.subclasses.sort!.map { |s| auto_link_code(s, :name => :long) }.join(', ') %></p>
|
11
|
+
<%= end_layout_section %>
|
12
|
+
<% end %>
|
13
|
+
<% end %>
|
14
|
+
|
15
|
+
<% if object.included_mixins? %>
|
16
|
+
<%= layout_section('Includes', :mixins) %>
|
17
|
+
<p><%= object.included_mixins.sort!.map { |m| auto_link_code(m, :name => :long) }.join(', ') %></p>
|
18
|
+
<%= end_layout_section %>
|
19
|
+
<% end %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<li><%= auto_link_code(object, :name => :short, :class => class_names_for(object)) %></li>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<pre class="syntax"><code class="ebnf"><%= method_synopsis(object).join('<br />') %></code></pre>
|
2
|
+
<% if object.respond_to?(:arguments) && object.arguments? %>
|
3
|
+
<ul class="argument-list">
|
4
|
+
<% object.arguments.each do |arg| %>
|
5
|
+
<li>
|
6
|
+
<code class="argument-name"><%= arg.name %></code>
|
7
|
+
<% unless arg.types.empty? %>
|
8
|
+
<span class="argument-types">(<%= auto_link_types(arg.types).map { |t| "<code>#{t}</code>"}.join(' | ') %>)</span>
|
9
|
+
<% end %>
|
10
|
+
<%= ' – ' + inline_htmlize(arg.description) unless arg.description.empty? %>
|
11
|
+
</li>
|
12
|
+
<% end %>
|
13
|
+
</ul> <!-- .argument-list -->
|
14
|
+
<% end %>
|
@@ -0,0 +1,9 @@
|
|
1
|
+
<% if object.methodized? %>
|
2
|
+
<p class="note">
|
3
|
+
<% if object.respond_to?(:methodized_self) %>
|
4
|
+
This method can be called <em>either</em> as an <a href="<%= path_to(object.methodized_self) %>">instance method</a> <em>or</em> as a generic method.
|
5
|
+
<% else %>
|
6
|
+
This method can be called <em>either</em> as an instance method <em>or</em> as a <a href="<%= path_to(object.functionalized_self) %>">generic method</a>.
|
7
|
+
<% end %>
|
8
|
+
If calling as a generic, pass the instance in as the first argument.<p>
|
9
|
+
<% end %>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<% if object.aliases? %>
|
2
|
+
<p class="alias aliases">Aliased as: <%= object.aliases.map.map { |a| auto_link_code(a, :name => :long) }.join(', ') %></p>
|
3
|
+
<% end %>
|
4
|
+
|
5
|
+
<% if object.alias? %>
|
6
|
+
<p class="alias alias-of">Alias of: <%= auto_link_code(object.alias, :name => :long) %></p>
|
7
|
+
<% end %>
|
8
|
+
|
9
|
+
<% if object.respond_to?(:related_to) && related_to = object.related_to %>
|
10
|
+
<p class="related-to">Related to: <%= auto_link_code(related_to, :name => :long) %></p>
|
11
|
+
<% end %>
|
@@ -0,0 +1,22 @@
|
|
1
|
+
<% @title = object.full_name %>
|
2
|
+
|
3
|
+
<% if object.deprecated? %>
|
4
|
+
<div id="deprecated"><%= img_tag('pdoc/deprecated.png', :alt => "Deprecated", :width => 150, :height => 150) %></div>
|
5
|
+
<% end %>
|
6
|
+
|
7
|
+
<ul class="breadcrumbs clearfix">
|
8
|
+
<li><a href="<%= path_prefix %>">Home</a></li>
|
9
|
+
<% breadcrumb(object).each do |crumb| %>
|
10
|
+
<li>→ <%= crumb %></li>
|
11
|
+
<% end %>
|
12
|
+
</ul>
|
13
|
+
|
14
|
+
<% if object.respond_to?(:src_code_href) && object.src_code_href %>
|
15
|
+
<p id="src_code_href"><a href="<%= object.src_code_href %>">src code</a></p>
|
16
|
+
<% end %>
|
17
|
+
|
18
|
+
<h2 class="page-title">
|
19
|
+
<span class="type"><%= object.type %></span> <%= object.full_name %>
|
20
|
+
</h2>
|
21
|
+
|
22
|
+
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<% @title = "#{@doc_instance.full_name} " %>
|
2
|
+
|
3
|
+
<%= include "partials/title", :object => @doc_instance %>
|
4
|
+
<%= include "partials/description", :object => @doc_instance %>
|
5
|
+
|
6
|
+
<% if @doc_instance.respond_to?(:utilities) && @doc_instance.utilities? %>
|
7
|
+
<%= layout_section('Utilities') %>
|
8
|
+
<ul class="method-list">
|
9
|
+
<% @doc_instance.utilities.each do |utility| %>
|
10
|
+
<li><%= auto_link_code(utility) %></li>
|
11
|
+
<% end %>
|
12
|
+
</ul>
|
13
|
+
<%= end_layout_section %>
|
14
|
+
<% end %>
|
15
|
+
|
16
|
+
<%= include "partials/namespaces", :object => @doc_instance %>
|
17
|
+
<%= include "partials/classes", :object => @doc_instance %>
|
18
|
+
<%= include "partials/mixins", :object => @doc_instance %>
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__), "..", "parser_test_helper"))
|
2
|
+
|
3
|
+
class ArgumentDescriptionTest < Test::Unit::TestCase
|
4
|
+
include PDocTestHelper
|
5
|
+
include Basic
|
6
|
+
include ArgumentDescription
|
7
|
+
|
8
|
+
def setup
|
9
|
+
@parser = ArgumentDescriptionParser.new
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_argument_with_no_type
|
13
|
+
fixture = parse("\n * - foo: a definition#{blank_line}")
|
14
|
+
assert_equal "foo", fixture.name
|
15
|
+
assert_equal [], fixture.types
|
16
|
+
assert_equal "a definition", fixture.description
|
17
|
+
|
18
|
+
fixture = parse("\n * - @foo: a definition#{blank_line}")
|
19
|
+
assert_equal "foo", fixture.name
|
20
|
+
assert_equal [], fixture.types
|
21
|
+
assert_equal "a definition", fixture.description
|
22
|
+
|
23
|
+
fixture = parse("\n * - foo: a rather long definition \n* that extends to a second line. #{blank_line}")
|
24
|
+
assert_equal "a rather long definition that extends to a second line.", fixture.description
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_argument_with_single_type
|
28
|
+
fixture = parse("\n * - foo (String): a definition#{blank_line}")
|
29
|
+
assert_equal "foo", fixture.name
|
30
|
+
assert_equal %w[String], fixture.types
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_argument_with_multiple_types
|
34
|
+
fixture = parse("\n * - foo (String | Number): a definition#{blank_line}")
|
35
|
+
assert_equal "foo", fixture.name
|
36
|
+
assert_equal %w[String Number], fixture.types
|
37
|
+
fixture = parse("\n * - foo (String | Number | Object): a definition#{blank_line}")
|
38
|
+
assert_equal %w[String Number Object], fixture.types
|
39
|
+
end
|
40
|
+
end
|