enumerable-statistics 0.1.0 → 1.0.1

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.
Files changed (125) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +1 -0
  3. data/CHANGELOG.md +15 -0
  4. data/LICENSE +21 -0
  5. data/README.md +60 -4
  6. data/Rakefile +11 -0
  7. data/bench/mean.rb +27 -0
  8. data/bench/sum.rb +26 -0
  9. data/bench/variance.rb +30 -0
  10. data/enumerable-statistics.gemspec +1 -0
  11. data/ext/enumerable/statistics/extension/statistics.c +811 -46
  12. data/images/benchmark.png +0 -0
  13. data/lib/enumerable/statistics/version.rb +1 -1
  14. data/yard/templates/mathjax/class/dot/setup.rb +6 -0
  15. data/yard/templates/mathjax/class/dot/superklass.erb +3 -0
  16. data/yard/templates/mathjax/class/html/constructor_details.erb +8 -0
  17. data/yard/templates/mathjax/class/html/setup.rb +1 -0
  18. data/yard/templates/mathjax/class/html/subclasses.erb +4 -0
  19. data/yard/templates/mathjax/class/setup.rb +36 -0
  20. data/yard/templates/mathjax/class/text/setup.rb +11 -0
  21. data/yard/templates/mathjax/class/text/subclasses.erb +5 -0
  22. data/yard/templates/mathjax/constant/text/header.erb +11 -0
  23. data/yard/templates/mathjax/constant/text/setup.rb +3 -0
  24. data/yard/templates/mathjax/docstring/html/abstract.erb +4 -0
  25. data/yard/templates/mathjax/docstring/html/deprecated.erb +1 -0
  26. data/yard/templates/mathjax/docstring/html/index.erb +5 -0
  27. data/yard/templates/mathjax/docstring/html/note.erb +6 -0
  28. data/yard/templates/mathjax/docstring/html/private.erb +4 -0
  29. data/yard/templates/mathjax/docstring/html/returns_void.erb +1 -0
  30. data/yard/templates/mathjax/docstring/html/text.erb +1 -0
  31. data/yard/templates/mathjax/docstring/html/todo.erb +6 -0
  32. data/yard/templates/mathjax/docstring/setup.rb +51 -0
  33. data/yard/templates/mathjax/docstring/text/abstract.erb +2 -0
  34. data/yard/templates/mathjax/docstring/text/deprecated.erb +2 -0
  35. data/yard/templates/mathjax/docstring/text/index.erb +2 -0
  36. data/yard/templates/mathjax/docstring/text/note.erb +4 -0
  37. data/yard/templates/mathjax/docstring/text/private.erb +2 -0
  38. data/yard/templates/mathjax/docstring/text/returns_void.erb +1 -0
  39. data/yard/templates/mathjax/docstring/text/text.erb +1 -0
  40. data/yard/templates/mathjax/docstring/text/todo.erb +4 -0
  41. data/yard/templates/mathjax/fulldoc/html/css/common.css +1 -0
  42. data/yard/templates/mathjax/fulldoc/html/css/full_list.css +58 -0
  43. data/yard/templates/mathjax/fulldoc/html/css/style.css +481 -0
  44. data/yard/templates/mathjax/fulldoc/html/frames.erb +17 -0
  45. data/yard/templates/mathjax/fulldoc/html/full_list.erb +37 -0
  46. data/yard/templates/mathjax/fulldoc/html/full_list_class.erb +2 -0
  47. data/yard/templates/mathjax/fulldoc/html/full_list_file.erb +7 -0
  48. data/yard/templates/mathjax/fulldoc/html/full_list_method.erb +10 -0
  49. data/yard/templates/mathjax/fulldoc/html/js/app.js +243 -0
  50. data/yard/templates/mathjax/fulldoc/html/js/full_list.js +216 -0
  51. data/yard/templates/mathjax/fulldoc/html/js/jquery.js +4 -0
  52. data/yard/templates/mathjax/fulldoc/html/setup.rb +242 -0
  53. data/yard/templates/mathjax/layout/dot/header.erb +6 -0
  54. data/yard/templates/mathjax/layout/dot/setup.rb +14 -0
  55. data/yard/templates/mathjax/layout/html/breadcrumb.erb +11 -0
  56. data/yard/templates/mathjax/layout/html/files.erb +11 -0
  57. data/yard/templates/mathjax/layout/html/footer.erb +5 -0
  58. data/yard/templates/mathjax/layout/html/headers.erb +15 -0
  59. data/yard/templates/mathjax/layout/html/index.erb +2 -0
  60. data/yard/templates/mathjax/layout/html/layout.erb +38 -0
  61. data/yard/templates/mathjax/layout/html/listing.erb +4 -0
  62. data/yard/templates/mathjax/layout/html/objects.erb +32 -0
  63. data/yard/templates/mathjax/layout/html/script_setup.erb +4 -0
  64. data/yard/templates/mathjax/layout/html/search.erb +13 -0
  65. data/yard/templates/mathjax/layout/html/setup.rb +87 -0
  66. data/yard/templates/mathjax/method/html/header.erb +17 -0
  67. data/yard/templates/mathjax/method/setup.rb +3 -0
  68. data/yard/templates/mathjax/method/text/header.erb +1 -0
  69. data/yard/templates/mathjax/method_details/html/header.erb +3 -0
  70. data/yard/templates/mathjax/method_details/html/method_signature.erb +25 -0
  71. data/yard/templates/mathjax/method_details/html/source.erb +10 -0
  72. data/yard/templates/mathjax/method_details/setup.rb +10 -0
  73. data/yard/templates/mathjax/method_details/text/header.erb +10 -0
  74. data/yard/templates/mathjax/method_details/text/method_signature.erb +12 -0
  75. data/yard/templates/mathjax/method_details/text/setup.rb +10 -0
  76. data/yard/templates/mathjax/module/dot/child.erb +1 -0
  77. data/yard/templates/mathjax/module/dot/dependencies.erb +3 -0
  78. data/yard/templates/mathjax/module/dot/header.erb +6 -0
  79. data/yard/templates/mathjax/module/dot/info.erb +14 -0
  80. data/yard/templates/mathjax/module/dot/setup.rb +14 -0
  81. data/yard/templates/mathjax/module/html/attribute_details.erb +10 -0
  82. data/yard/templates/mathjax/module/html/attribute_summary.erb +8 -0
  83. data/yard/templates/mathjax/module/html/box_info.erb +43 -0
  84. data/yard/templates/mathjax/module/html/children.erb +8 -0
  85. data/yard/templates/mathjax/module/html/constant_summary.erb +11 -0
  86. data/yard/templates/mathjax/module/html/defines.erb +3 -0
  87. data/yard/templates/mathjax/module/html/header.erb +5 -0
  88. data/yard/templates/mathjax/module/html/inherited_attributes.erb +14 -0
  89. data/yard/templates/mathjax/module/html/inherited_constants.erb +8 -0
  90. data/yard/templates/mathjax/module/html/inherited_methods.erb +19 -0
  91. data/yard/templates/mathjax/module/html/item_summary.erb +40 -0
  92. data/yard/templates/mathjax/module/html/method_details_list.erb +9 -0
  93. data/yard/templates/mathjax/module/html/method_summary.erb +14 -0
  94. data/yard/templates/mathjax/module/html/methodmissing.erb +12 -0
  95. data/yard/templates/mathjax/module/html/pre_docstring.erb +1 -0
  96. data/yard/templates/mathjax/module/setup.rb +164 -0
  97. data/yard/templates/mathjax/module/text/children.erb +10 -0
  98. data/yard/templates/mathjax/module/text/class_meths_list.erb +8 -0
  99. data/yard/templates/mathjax/module/text/extends.erb +8 -0
  100. data/yard/templates/mathjax/module/text/header.erb +7 -0
  101. data/yard/templates/mathjax/module/text/includes.erb +8 -0
  102. data/yard/templates/mathjax/module/text/instance_meths_list.erb +8 -0
  103. data/yard/templates/mathjax/module/text/setup.rb +12 -0
  104. data/yard/templates/mathjax/onefile/html/files.erb +5 -0
  105. data/yard/templates/mathjax/onefile/html/headers.erb +6 -0
  106. data/yard/templates/mathjax/onefile/html/layout.erb +29 -0
  107. data/yard/templates/mathjax/onefile/html/readme.erb +3 -0
  108. data/yard/templates/mathjax/onefile/html/setup.rb +61 -0
  109. data/yard/templates/mathjax/root/dot/child.erb +3 -0
  110. data/yard/templates/mathjax/root/dot/setup.rb +5 -0
  111. data/yard/templates/mathjax/root/html/setup.rb +1 -0
  112. data/yard/templates/mathjax/tags/html/example.erb +11 -0
  113. data/yard/templates/mathjax/tags/html/index.erb +3 -0
  114. data/yard/templates/mathjax/tags/html/option.erb +24 -0
  115. data/yard/templates/mathjax/tags/html/overload.erb +14 -0
  116. data/yard/templates/mathjax/tags/html/see.erb +8 -0
  117. data/yard/templates/mathjax/tags/html/tag.erb +20 -0
  118. data/yard/templates/mathjax/tags/setup.rb +55 -0
  119. data/yard/templates/mathjax/tags/text/example.erb +12 -0
  120. data/yard/templates/mathjax/tags/text/index.erb +1 -0
  121. data/yard/templates/mathjax/tags/text/option.erb +20 -0
  122. data/yard/templates/mathjax/tags/text/overload.erb +19 -0
  123. data/yard/templates/mathjax/tags/text/see.erb +11 -0
  124. data/yard/templates/mathjax/tags/text/tag.erb +13 -0
  125. metadata +134 -2
@@ -0,0 +1,17 @@
1
+ <h1>Method: <%= object.path %></h1>
2
+ <div class="box_info">
3
+ <dl>
4
+ <dt class="">Defined in:</dt>
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 /> ") %></div>
8
+ <% end %>
9
+ </dd>
10
+ </dl>
11
+ </div>
12
+
13
+ <div class="method_details_list">
14
+ <div id="method_details">
15
+ <%= yieldall :index => 0 %>
16
+ </div>
17
+ </div>
@@ -0,0 +1,3 @@
1
+ def init
2
+ sections :header, [T('method_details')]
3
+ end
@@ -0,0 +1 @@
1
+ <%= yieldall %>
@@ -0,0 +1,3 @@
1
+ <div class="method_details <%= @index == 0 ? 'first' : '' %>">
2
+ <%= yieldall %>
3
+ </div>
@@ -0,0 +1,25 @@
1
+ <h3 class="signature <%= 'first' if @index == 0 %>" id="<%= anchor_for(object) %>">
2
+ <% if object.tags(:overload).size == 1 %>
3
+ <%= signature(object.tag(:overload), false) %>
4
+ <% elsif object.tags(:overload).size > 1 %>
5
+ <% object.tags(:overload).each do |overload| %>
6
+ <span class="overload"><%= signature(overload, false) %></span>
7
+ <% end %>
8
+ <% else %>
9
+ <%= signature(object, false) %>
10
+ <% end %>
11
+
12
+ <% if object.aliases.size > 0 %>
13
+ <span class="aliases">Also known as:
14
+ <span class="names"><%= object.aliases.map {|o|
15
+ "<span id='#{anchor_for(o)}'>" + h(o.name.to_s) + "</span>" }.join(", ") %></span>
16
+ </span>
17
+ <% end %>
18
+
19
+ <% if owner != object.namespace %>
20
+ <span class="not_defined_here">
21
+ Originally defined in <%= object.namespace.type %>
22
+ <%= linkify object, owner.relative_path(object.namespace) %>
23
+ </span>
24
+ <% end %>
25
+ </h3>
@@ -0,0 +1,10 @@
1
+ <table class="source_code">
2
+ <tr>
3
+ <td>
4
+ <pre class="lines"><%= "\n\n\n" %><%= h format_lines(object) %></pre>
5
+ </td>
6
+ <td>
7
+ <pre class="code"><span class="info file"># File '<%= h object.file %>'<% if object.line %>, line <%= object.line %><% end %></span><%= "\n\n" %><%= html_syntax_highlight object.source %></pre>
8
+ </td>
9
+ </tr>
10
+ </table>
@@ -0,0 +1,10 @@
1
+ def init
2
+ sections :header, [:method_signature, T('docstring'), :source]
3
+ end
4
+
5
+ def source
6
+ return if owner != object.namespace
7
+ return if Tags::OverloadTag === object
8
+ return if object.source.nil?
9
+ erb(:source)
10
+ end
@@ -0,0 +1,10 @@
1
+ <%= title_align_right format_object_title(object) %>
2
+
3
+ <%= align_right "(Defined in: #{object.file})" %>
4
+ <% if object.aliases.size > 0 %>
5
+
6
+ <%= align_right "(Also known as: #{object.aliases.map {|o| o.name(true).to_s }.join(',')})" %>
7
+ <% end %>
8
+
9
+ <%= yieldall %>
10
+
@@ -0,0 +1,12 @@
1
+
2
+ <% if object.tags(:overload).size == 1 %>
3
+ <%= indent wrap(signature(object.tag(:overload))) %>
4
+ <% elsif object.tags(:overload).size > 1 %>
5
+ <% object.tags(:overload).each do |overload| %>
6
+ <%= indent wrap(signature(overload)) %>
7
+ <% end %>
8
+ <% else %>
9
+ <%= indent wrap(signature(object)) %>
10
+ <% end %>
11
+ <%= hr %>
12
+
@@ -0,0 +1,10 @@
1
+ def init
2
+ super
3
+ sections.last.pop
4
+ end
5
+
6
+ def format_object_title(object)
7
+ title = "Method: #{object.name(true)}"
8
+ title += " (#{object.namespace})" if !object.namespace.root?
9
+ title
10
+ end
@@ -0,0 +1 @@
1
+ <%= format_path object %> [label="{<%= yieldall.gsub("\n", '') %>}" rank=sink];
@@ -0,0 +1,3 @@
1
+ <% object.mixins(:instance).each do |obj| %>
2
+ <%= format_path object %> -> <%= format_path obj %> [style=dotted arrowType=none];
3
+ <% end %>
@@ -0,0 +1,6 @@
1
+ subgraph cluster_<%= format_path object %> {
2
+ label = "<%= h(object.name) unless object.path == "" %>"; labelloc=b;
3
+ <% for obj in @modules %>
4
+ <%= yieldall :object => obj %>
5
+ <% end %>
6
+ }
@@ -0,0 +1,14 @@
1
+ <%= object.type %> <%= h object.name %>
2
+ <% if options.full %>
3
+ |
4
+ <% object.attributes.each do |scope, list| %>
5
+ <% list.sort_by {|name, rw| name.to_s }.each do |name, rw| %>
6
+ <%= uml_visibility(rw.values.compact.first) %> <%= h (rw[:read]||rw[:write]).name(true).gsub(/=$/,'') %> [<%= 'R' if rw[:read] %><%= 'W' if rw[:write] %>]\l
7
+ <% end %>
8
+ <% end %>
9
+ |
10
+ <% method_listing.each do |obj| %>
11
+ <%= uml_visibility obj %> <%= h obj.name(true) %>
12
+ <%= h(" : #{obj.tag(:return).types.first}") if obj.has_tag?(:return) && obj.tag(:return).types && obj.tag(:return).types.size > 0 %>\l
13
+ <% end %>
14
+ <% end %>
@@ -0,0 +1,14 @@
1
+ def init
2
+ @modules = object.children.select {|o| o.type == :module }
3
+ @classes = object.children.select {|o| o.type == :class }
4
+ sections :child, [:info], :classes, [T('class')], :header, [T('module')], :dependencies
5
+ end
6
+
7
+ def dependencies
8
+ return unless options.dependencies
9
+ erb(:dependencies)
10
+ end
11
+
12
+ def classes
13
+ @classes.map {|k| yieldall :object => k }.join("\n")
14
+ end
@@ -0,0 +1,10 @@
1
+ <% scopes(attr_listing) do |list, scope| %>
2
+ <div id="<%= scope %>_attr_details" class="attr_details">
3
+ <h2><%= scope.to_s.capitalize %> Attribute Details</h2>
4
+ <% list.each_with_index do |meth, i| %>
5
+ <% rw = meth.attr_info %>
6
+ <span id="<%= anchor_for(rw[meth.reader? ? :write : :read]) %>"></span>
7
+ <%= yieldall :object => meth, :owner => object, :index => i %>
8
+ <% end %>
9
+ </div>
10
+ <% end %>
@@ -0,0 +1,8 @@
1
+ <% groups(attr_listing, "Attribute") do |list, name| %>
2
+ <h2><%= name %> <small><a href="#" class="summary_toggle">collapse</a></small></h2>
3
+ <ul class="summary">
4
+ <% list.each do |meth| %>
5
+ <%= yieldall :item => meth %>
6
+ <% end %>
7
+ </ul>
8
+ <% end %>
@@ -0,0 +1,43 @@
1
+ <div class="box_info">
2
+ <% if CodeObjects::ClassObject === object && object.superclass %>
3
+ <dl>
4
+ <dt>Inherits:</dt>
5
+ <dd>
6
+ <span class="inheritName"><%= linkify object.superclass %></span>
7
+ <% if object.superclass.name != :BasicObject %>
8
+ <ul class="fullTree">
9
+ <li><%= linkify P(:Object) %></li>
10
+ <% object.inheritance_tree.reverse.each_with_index do |obj, i| %>
11
+ <li class="next"><%= obj == object ? obj.path : linkify(obj) %></li>
12
+ <% end %>
13
+ </ul>
14
+ <a href="#" class="inheritanceTree">show all</a>
15
+ <% end %>
16
+ </dd>
17
+ </dl>
18
+ <% end %>
19
+
20
+ <% [[:class, "Extended by"], [:instance, "Includes"]].each do |scope, name| %>
21
+ <% if (mix = run_verifier(object.mixins(scope))).size > 0 %>
22
+ <dl>
23
+ <dt><%= name %>:</dt>
24
+ <dd><%= mix.sort_by {|o| o.path }.map {|o| linkify(o) }.join(", ") %></dd>
25
+ </dl>
26
+ <% end %>
27
+ <% end %>
28
+
29
+ <% if (mixed_into = mixed_into(object)).size > 0 %>
30
+ <dl>
31
+ <dt>Included in:</dt>
32
+ <dd><%= mixed_into.sort_by {|o| o.path }.map {|o| linkify(o) }.join(", ") %></dd>
33
+ </dl>
34
+ <% end %>
35
+
36
+ <% unless object.root? %>
37
+ <dl>
38
+ <dt>Defined in:</dt>
39
+ <dd><%= erb(:defines) %></dd>
40
+ </dl>
41
+ <% end %>
42
+ </div>
43
+
@@ -0,0 +1,8 @@
1
+ <h2>Defined Under Namespace</h2>
2
+ <p class="children">
3
+ <% @inner.each do |name, list| %>
4
+ <% if list.size > 0 %>
5
+ <strong class="<%= name %>"><%= name.to_s.capitalize %>:</strong> <%= list.map {|child| linkify(child, child.name(true)) }.join(", ") %>
6
+ <% end %>
7
+ <% end %>
8
+ </p>
@@ -0,0 +1,11 @@
1
+ <% if constant_listing.size > 0 %>
2
+ <h2>Constant Summary</h2>
3
+ <dl class="constants">
4
+ <% constant_listing.each do |cnst| %>
5
+ <dt id="<%= anchor_for(cnst) %>" class="<%= cnst.has_tag?(:deprecated) ? 'deprecated' : '' %>"><%= cnst.name %> =
6
+ <%= yieldall :object => cnst %>
7
+ </dt>
8
+ <dd><pre class="code"><%= format_constant cnst.value %></pre></dd>
9
+ <% end %>
10
+ </dl>
11
+ <% end %>
@@ -0,0 +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 /> ") %></span>
3
+ <% end %>
@@ -0,0 +1,5 @@
1
+ <h1><%= format_object_title(object) %>
2
+ <% if object.has_tag?(:abstract) %><span class="abstract note title">Abstract</span><% end %>
3
+ <% if object.has_tag?(:deprecated) %><span class="deprecated note title">Deprecated</span><% end %>
4
+ <% if object.has_tag?(:api) && object.tag(:api).text == 'private' %><span class="private note title">Private</span><% end %>
5
+ </h1>
@@ -0,0 +1,14 @@
1
+ <% found_method = false %>
2
+ <% inherited_attr_list do |superclass, attribs| %>
3
+ <% if attr_listing.size == 0 && !found_method %><h2>Instance Attribute Summary</h2><% end %>
4
+ <% found_method = true %>
5
+ <h3 class="inherited">Attributes <%= superclass.type == :class ? 'inherited' : 'included' %> from <%= linkify superclass %></h3>
6
+ <p class="inherited"><%= attribs.map do |method|
7
+ name = method.name(true).gsub(/=$/, '')
8
+ if superclass.type == :module && object.instance_mixins.include?(superclass)
9
+ name = "##{name}" unless name =~ /^#/
10
+ end
11
+ linkify(method, name)
12
+ end.join(", ")
13
+ %></p>
14
+ <% end %>
@@ -0,0 +1,8 @@
1
+ <% found_const = false %>
2
+ <% inherited_constant_list do |superclass, consts| %>
3
+ <% if constant_listing.size == 0 && !found_const %><h2>Constant Summary</h2><% end %>
4
+ <% found_const = true %>
5
+ <h3 class="inherited">Constants <%= superclass.type == :class ? 'inherited' : 'included' %>
6
+ from <%= linkify superclass %></h3>
7
+ <p class="inherited"><%= consts.map {|c| linkify c }.join(", ") %></p>
8
+ <% end %>
@@ -0,0 +1,19 @@
1
+ <% found_method = false %>
2
+ <% object.inheritance_tree(true)[1..-1].each do |superclass| %>
3
+ <% next if superclass.is_a?(YARD::CodeObjects::Proxy) %>
4
+ <% next if options.embed_mixins.size > 0 && options.embed_mixins_match?(superclass) != false %>
5
+ <% meths = prune_method_listing(superclass.meths(:included => false, :inherited => false)) %>
6
+ <% meths.reject! {|m| object.child(:scope => m.scope, :name => m.name) != nil } %>
7
+ <% meths.reject! {|m| m.is_alias? || m.is_attribute? } %>
8
+ <% next if meths.size == 0 %>
9
+ <% if method_listing.size == 0 && !found_method %><h2>Method Summary</h2><% end %>
10
+ <% found_method = true %>
11
+ <h3 class="inherited">Methods <%= superclass.type == :class ? 'inherited' : 'included' %> from <%= linkify superclass %></h3>
12
+ <p class="inherited"><%=
13
+ meths.sort_by {|o| o.name.to_s }.map do |m|
14
+ name = m.name(true)
15
+ name = name.gsub(/^#/,'') if superclass.type == :module && object.class_mixins.include?(superclass)
16
+ linkify(m, name)
17
+ end.join(", ")
18
+ %></p>
19
+ <% end %>
@@ -0,0 +1,40 @@
1
+ <li class="<%= @item.visibility %> <%= @item.has_tag?(:deprecated) ? 'deprecated' : '' %>">
2
+ <span class="summary_signature">
3
+ <% if @item.tags(:overload).size == 1 %>
4
+ <%= signature(@item.tag(:overload), true, false, !@item.attr_info) %>
5
+ <% else %>
6
+ <%= signature(@item, true, false, !@item.attr_info) %>
7
+ <% end %>
8
+
9
+ <% if @item.aliases.size > 0 %>
10
+ (also: <%= @item.aliases.map {|o| h(o.name(true)) }.join(", ") %>)
11
+ <% end %>
12
+ </span>
13
+ <% if object != @item.namespace %>
14
+ <span class="note title not_defined_here">
15
+ <%= @item.namespace.type == :class ? 'inherited' : (@item.scope == :class ? 'extended' : 'included') %>
16
+ from <%= linkify @item, object.relative_path(@item.namespace) %>
17
+ </span>
18
+ <% end %>
19
+ <% if @item.constructor? %>
20
+ <span class="note title constructor">constructor</span>
21
+ <% end %>
22
+ <% if rw = @item.attr_info %>
23
+ <% if !run_verifier([rw[:read]].compact).empty? && run_verifier([rw[:write]].compact).empty? %>
24
+ <span class="note title readonly">readonly</span>
25
+ <% end %>
26
+ <% if !run_verifier([rw[:write]].compact).empty? && run_verifier([rw[:read]].compact).empty? %>
27
+ <span class="note title writeonly">writeonly</span>
28
+ <% end %>
29
+ <% end %>
30
+ <% if @item.visibility != :public %><span class="note title <%= @item.visibility %>"><%= @item.visibility %></span><% end %>
31
+ <% if @item.has_tag?(:abstract) %><span class="abstract note title">abstract</span><% end %>
32
+ <% if @item.has_tag?(:deprecated) %><span class="deprecated note title">deprecated</span><% end %>
33
+ <% if @item.has_tag?(:api) && @item.tag(:api).text == 'private' %><span class="private note title">private</span><% end %>
34
+
35
+ <% if @item.has_tag?(:deprecated) %>
36
+ <span class="summary_desc"><strong>Deprecated.</strong> <%= htmlify_line @item.tag(:deprecated).text %></span>
37
+ <% else %>
38
+ <span class="summary_desc"><%= htmlify_line docstring_summary(@item) %></span>
39
+ <% end %>
40
+ </li>
@@ -0,0 +1,9 @@
1
+ <% scopes(method_listing(false)) do |list, scope| %>
2
+ <div id="<%= scope %>_method_details" class="method_details_list">
3
+ <h2><%= scope.to_s.capitalize %> Method Details</h2>
4
+
5
+ <% list.each_with_index do |meth, i| %>
6
+ <%= yieldall :object => meth, :owner => object, :index => i %>
7
+ <% end %>
8
+ </div>
9
+ <% end %>
@@ -0,0 +1,14 @@
1
+ <% if method_listing.size > 0 %>
2
+ <% groups(method_listing) do |list, name| %>
3
+ <h2>
4
+ <%= name %>
5
+ <small><a href="#" class="summary_toggle">collapse</a></small>
6
+ </h2>
7
+
8
+ <ul class="summary">
9
+ <% list.each do |meth| %>
10
+ <%= yieldall :item => meth %>
11
+ <% end %>
12
+ </ul>
13
+ <% end %>
14
+ <% end %>
@@ -0,0 +1,12 @@
1
+ <div id="method_missing_details" class="method_details_list">
2
+ <h2>Dynamic Method Handling</h2>
3
+ <p class="notice <%= @mm.namespace == object ? 'this' : 'super' %>">
4
+ This class handles dynamic methods through the <tt>method_missing</tt> method
5
+ <% if @mm.namespace != object %>
6
+ in the class <%= linkify @mm, @mm.namespace.path %>
7
+ <% end %>
8
+ </p>
9
+ <% if @mm.namespace == object %>
10
+ <%= yieldall :object => @mm, :index => 0 %>
11
+ <% end %>
12
+ </div>
@@ -0,0 +1 @@
1
+ <h2>Overview</h2>
@@ -0,0 +1,164 @@
1
+ include Helpers::ModuleHelper
2
+
3
+ def init
4
+ sections :header, :box_info, :pre_docstring, T('docstring'), :children,
5
+ :constant_summary, [T('docstring')], :inherited_constants,
6
+ :attribute_summary, [:item_summary], :inherited_attributes,
7
+ :method_summary, [:item_summary], :inherited_methods,
8
+ :methodmissing, [T('method_details')],
9
+ :attribute_details, [T('method_details')],
10
+ :method_details_list, [T('method_details')]
11
+ end
12
+
13
+ def pre_docstring
14
+ return if object.docstring.blank?
15
+ erb(:pre_docstring)
16
+ end
17
+
18
+ def children
19
+ @inner = [[:modules, []], [:classes, []]]
20
+ object.children.each do |child|
21
+ @inner[0][1] << child if child.type == :module
22
+ @inner[1][1] << child if child.type == :class
23
+ end
24
+ @inner.map! {|v| [v[0], run_verifier(v[1].sort_by {|o| o.name.to_s })] }
25
+ return if (@inner[0][1].size + @inner[1][1].size) == 0
26
+ erb(:children)
27
+ end
28
+
29
+ def methodmissing
30
+ mms = object.meths(:inherited => true, :included => true)
31
+ return unless @mm = mms.find {|o| o.name == :method_missing && o.scope == :instance }
32
+ erb(:methodmissing)
33
+ end
34
+
35
+ def method_listing(include_specials = true)
36
+ return @smeths ||= method_listing.reject {|o| special_method?(o) } unless include_specials
37
+ return @meths if @meths
38
+ @meths = object.meths(:inherited => false, :included => !options.embed_mixins.empty?)
39
+ if options.embed_mixins.size > 0
40
+ @meths = @meths.reject {|m| options.embed_mixins_match?(m.namespace) == false }
41
+ end
42
+ @meths = sort_listing(prune_method_listing(@meths))
43
+ @meths
44
+ end
45
+
46
+ def special_method?(meth)
47
+ return true if meth.name(true) == '#method_missing'
48
+ return true if meth.constructor?
49
+ false
50
+ end
51
+
52
+ def attr_listing
53
+ return @attrs if @attrs
54
+ @attrs = []
55
+ object.inheritance_tree(true).each do |superclass|
56
+ next if superclass.is_a?(CodeObjects::Proxy)
57
+ next if options.embed_mixins.size > 0 &&
58
+ !options.embed_mixins_match?(superclass)
59
+ [:class, :instance].each do |scope|
60
+ superclass.attributes[scope].each do |name, rw|
61
+ attr = prune_method_listing([rw[:read], rw[:write]].compact, false).first
62
+ @attrs << attr if attr
63
+ end
64
+ end
65
+ break if options.embed_mixins.empty?
66
+ end
67
+ @attrs = sort_listing(@attrs)
68
+ end
69
+
70
+ def constant_listing
71
+ return @constants if @constants
72
+ @constants = object.constants(:included => false, :inherited => false)
73
+ @constants += object.cvars
74
+ @constants = run_verifier(@constants)
75
+ @constants
76
+ end
77
+
78
+ def sort_listing(list)
79
+ list.sort_by {|o| [o.scope.to_s, o.name.to_s.downcase] }
80
+ end
81
+
82
+ def inherited_attr_list(&block)
83
+ object.inheritance_tree(true)[1..-1].each do |superclass|
84
+ next if superclass.is_a?(YARD::CodeObjects::Proxy)
85
+ next if options.embed_mixins.size > 0 && options.embed_mixins_match?(superclass) != false
86
+ attribs = superclass.attributes[:instance]
87
+ attribs = attribs.reject {|name, rw| object.child(:scope => :instance, :name => name) != nil }
88
+ attribs = attribs.sort_by {|args| args.first.to_s }.map {|n, m| m[:read] || m[:write] }
89
+ attribs = prune_method_listing(attribs, false)
90
+ yield superclass, attribs if attribs.size > 0
91
+ end
92
+ end
93
+
94
+ def inherited_constant_list(&block)
95
+ object.inheritance_tree(true)[1..-1].each do |superclass|
96
+ next if superclass.is_a?(YARD::CodeObjects::Proxy)
97
+ next if options.embed_mixins.size > 0 && options.embed_mixins_match?(superclass) != false
98
+ consts = superclass.constants(:included => false, :inherited => false)
99
+ consts = consts.reject {|const| object.child(:type => :constant, :name => const.name) != nil }
100
+ consts = consts.sort_by {|const| const.name.to_s }
101
+ consts = run_verifier(consts)
102
+ yield superclass, consts if consts.size > 0
103
+ end
104
+ end
105
+
106
+ def docstring_full(obj)
107
+ docstring = ""
108
+ if obj.tags(:overload).size == 1 && obj.docstring.empty?
109
+ docstring = obj.tag(:overload).docstring
110
+ else
111
+ docstring = obj.docstring
112
+ end
113
+
114
+ if docstring.summary.empty? && obj.tags(:return).size == 1 && obj.tag(:return).text
115
+ docstring = Docstring.new(obj.tag(:return).text.gsub(/\A([a-z])/) {|x| x.upcase }.strip)
116
+ end
117
+
118
+ docstring
119
+ end
120
+
121
+ def docstring_summary(obj)
122
+ docstring_full(obj).summary
123
+ end
124
+
125
+ def groups(list, type = "Method")
126
+ if groups_data = object.groups
127
+ list.each {|m| groups_data |= [m.group] if m.group && owner != m.namespace }
128
+ others = list.select {|m| !m.group || !groups_data.include?(m.group) }
129
+ groups_data.each do |name|
130
+ items = list.select {|m| m.group == name }
131
+ yield(items, name) unless items.empty?
132
+ end
133
+ else
134
+ others = []
135
+ group_data = {}
136
+ list.each do |meth|
137
+ if meth.group
138
+ (group_data[meth.group] ||= []) << meth
139
+ else
140
+ others << meth
141
+ end
142
+ end
143
+ group_data.each {|group, items| yield(items, group) unless items.empty? }
144
+ end
145
+
146
+ scopes(others) {|items, scope| yield(items, "#{scope.to_s.capitalize} #{type} Summary") }
147
+ end
148
+
149
+ def scopes(list)
150
+ [:class, :instance].each do |scope|
151
+ items = list.select {|m| m.scope == scope }
152
+ yield(items, scope) unless items.empty?
153
+ end
154
+ end
155
+
156
+ def mixed_into(object)
157
+ unless globals.mixed_into
158
+ globals.mixed_into = {}
159
+ list = run_verifier Registry.all(:class, :module)
160
+ list.each {|o| o.mixins.each {|m| (globals.mixed_into[m.path] ||= []) << o } }
161
+ end
162
+
163
+ globals.mixed_into[object.path] || []
164
+ end