yard-to_mkdocs 0.1.0

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 (120) hide show
  1. checksums.yaml +7 -0
  2. data/.rspec +3 -0
  3. data/CHANGELOG.md +5 -0
  4. data/CODE_OF_CONDUCT.md +84 -0
  5. data/Gemfile +10 -0
  6. data/Gemfile.lock +38 -0
  7. data/LICENSE.txt +21 -0
  8. data/README.md +43 -0
  9. data/Rakefile +8 -0
  10. data/bin/console +15 -0
  11. data/bin/setup +8 -0
  12. data/lib/yard/to_mkdocs/default/class/dot/setup.rb +7 -0
  13. data/lib/yard/to_mkdocs/default/class/dot/superklass.erb +3 -0
  14. data/lib/yard/to_mkdocs/default/class/html/constructor_details.erb +7 -0
  15. data/lib/yard/to_mkdocs/default/class/html/setup.rb +2 -0
  16. data/lib/yard/to_mkdocs/default/class/html/subclasses.erb +3 -0
  17. data/lib/yard/to_mkdocs/default/class/setup.rb +36 -0
  18. data/lib/yard/to_mkdocs/default/class/text/setup.rb +12 -0
  19. data/lib/yard/to_mkdocs/default/class/text/subclasses.erb +5 -0
  20. data/lib/yard/to_mkdocs/default/constant/text/header.erb +9 -0
  21. data/lib/yard/to_mkdocs/default/constant/text/setup.rb +4 -0
  22. data/lib/yard/to_mkdocs/default/docstring/html/abstract.erb +1 -0
  23. data/lib/yard/to_mkdocs/default/docstring/html/deprecated.erb +1 -0
  24. data/lib/yard/to_mkdocs/default/docstring/html/index.erb +5 -0
  25. data/lib/yard/to_mkdocs/default/docstring/html/note.erb +4 -0
  26. data/lib/yard/to_mkdocs/default/docstring/html/private.erb +1 -0
  27. data/lib/yard/to_mkdocs/default/docstring/html/returns_void.erb +1 -0
  28. data/lib/yard/to_mkdocs/default/docstring/html/text.erb +1 -0
  29. data/lib/yard/to_mkdocs/default/docstring/html/todo.erb +4 -0
  30. data/lib/yard/to_mkdocs/default/docstring/setup.rb +52 -0
  31. data/lib/yard/to_mkdocs/default/docstring/text/abstract.erb +2 -0
  32. data/lib/yard/to_mkdocs/default/docstring/text/deprecated.erb +2 -0
  33. data/lib/yard/to_mkdocs/default/docstring/text/index.erb +2 -0
  34. data/lib/yard/to_mkdocs/default/docstring/text/note.erb +4 -0
  35. data/lib/yard/to_mkdocs/default/docstring/text/private.erb +2 -0
  36. data/lib/yard/to_mkdocs/default/docstring/text/returns_void.erb +1 -0
  37. data/lib/yard/to_mkdocs/default/docstring/text/text.erb +1 -0
  38. data/lib/yard/to_mkdocs/default/docstring/text/todo.erb +4 -0
  39. data/lib/yard/to_mkdocs/default/fulldoc/html/frames.erb +0 -0
  40. data/lib/yard/to_mkdocs/default/fulldoc/html/full_list.erb +1 -0
  41. data/lib/yard/to_mkdocs/default/fulldoc/html/full_list_class.erb +3 -0
  42. data/lib/yard/to_mkdocs/default/fulldoc/html/full_list_file.erb +4 -0
  43. data/lib/yard/to_mkdocs/default/fulldoc/html/full_list_method.erb +4 -0
  44. data/lib/yard/to_mkdocs/default/fulldoc/html/setup.rb +184 -0
  45. data/lib/yard/to_mkdocs/default/layout/dot/header.erb +6 -0
  46. data/lib/yard/to_mkdocs/default/layout/dot/setup.rb +15 -0
  47. data/lib/yard/to_mkdocs/default/layout/html/breadcrumb.erb +0 -0
  48. data/lib/yard/to_mkdocs/default/layout/html/files.erb +0 -0
  49. data/lib/yard/to_mkdocs/default/layout/html/footer.erb +0 -0
  50. data/lib/yard/to_mkdocs/default/layout/html/headers.erb +0 -0
  51. data/lib/yard/to_mkdocs/default/layout/html/index.erb +3 -0
  52. data/lib/yard/to_mkdocs/default/layout/html/layout.erb +1 -0
  53. data/lib/yard/to_mkdocs/default/layout/html/listing.erb +0 -0
  54. data/lib/yard/to_mkdocs/default/layout/html/objects.erb +0 -0
  55. data/lib/yard/to_mkdocs/default/layout/html/script_setup.erb +0 -0
  56. data/lib/yard/to_mkdocs/default/layout/html/search.erb +0 -0
  57. data/lib/yard/to_mkdocs/default/layout/html/setup.rb +87 -0
  58. data/lib/yard/to_mkdocs/default/method/html/header.erb +5 -0
  59. data/lib/yard/to_mkdocs/default/method/setup.rb +4 -0
  60. data/lib/yard/to_mkdocs/default/method/text/header.erb +1 -0
  61. data/lib/yard/to_mkdocs/default/method_details/html/header.erb +1 -0
  62. data/lib/yard/to_mkdocs/default/method_details/html/method_signature.erb +9 -0
  63. data/lib/yard/to_mkdocs/default/method_details/html/source.erb +5 -0
  64. data/lib/yard/to_mkdocs/default/method_details/setup.rb +11 -0
  65. data/lib/yard/to_mkdocs/default/method_details/text/header.erb +10 -0
  66. data/lib/yard/to_mkdocs/default/method_details/text/method_signature.erb +12 -0
  67. data/lib/yard/to_mkdocs/default/method_details/text/setup.rb +11 -0
  68. data/lib/yard/to_mkdocs/default/module/dot/child.erb +1 -0
  69. data/lib/yard/to_mkdocs/default/module/dot/dependencies.erb +3 -0
  70. data/lib/yard/to_mkdocs/default/module/dot/header.erb +6 -0
  71. data/lib/yard/to_mkdocs/default/module/dot/info.erb +14 -0
  72. data/lib/yard/to_mkdocs/default/module/dot/setup.rb +15 -0
  73. data/lib/yard/to_mkdocs/default/module/html/attribute_details.erb +7 -0
  74. data/lib/yard/to_mkdocs/default/module/html/attribute_summary.erb +7 -0
  75. data/lib/yard/to_mkdocs/default/module/html/box_info.erb +14 -0
  76. data/lib/yard/to_mkdocs/default/module/html/children.erb +7 -0
  77. data/lib/yard/to_mkdocs/default/module/html/constant_summary.erb +13 -0
  78. data/lib/yard/to_mkdocs/default/module/html/defines.erb +1 -0
  79. data/lib/yard/to_mkdocs/default/module/html/header.erb +1 -0
  80. data/lib/yard/to_mkdocs/default/module/html/inherited_attributes.erb +16 -0
  81. data/lib/yard/to_mkdocs/default/module/html/inherited_constants.erb +11 -0
  82. data/lib/yard/to_mkdocs/default/module/html/inherited_methods.erb +22 -0
  83. data/lib/yard/to_mkdocs/default/module/html/item_summary.erb +16 -0
  84. data/lib/yard/to_mkdocs/default/module/html/method_details_list.erb +7 -0
  85. data/lib/yard/to_mkdocs/default/module/html/method_summary.erb +9 -0
  86. data/lib/yard/to_mkdocs/default/module/html/methodmissing.erb +10 -0
  87. data/lib/yard/to_mkdocs/default/module/html/pre_docstring.erb +1 -0
  88. data/lib/yard/to_mkdocs/default/module/setup.rb +168 -0
  89. data/lib/yard/to_mkdocs/default/module/text/children.erb +10 -0
  90. data/lib/yard/to_mkdocs/default/module/text/class_meths_list.erb +8 -0
  91. data/lib/yard/to_mkdocs/default/module/text/extends.erb +8 -0
  92. data/lib/yard/to_mkdocs/default/module/text/header.erb +7 -0
  93. data/lib/yard/to_mkdocs/default/module/text/includes.erb +8 -0
  94. data/lib/yard/to_mkdocs/default/module/text/instance_meths_list.erb +8 -0
  95. data/lib/yard/to_mkdocs/default/module/text/setup.rb +13 -0
  96. data/lib/yard/to_mkdocs/default/onefile/html/files.erb +6 -0
  97. data/lib/yard/to_mkdocs/default/onefile/html/headers.erb +0 -0
  98. data/lib/yard/to_mkdocs/default/onefile/html/layout.erb +3 -0
  99. data/lib/yard/to_mkdocs/default/onefile/html/readme.erb +1 -0
  100. data/lib/yard/to_mkdocs/default/onefile/html/setup.rb +62 -0
  101. data/lib/yard/to_mkdocs/default/root/dot/child.erb +3 -0
  102. data/lib/yard/to_mkdocs/default/root/dot/setup.rb +6 -0
  103. data/lib/yard/to_mkdocs/default/root/html/setup.rb +2 -0
  104. data/lib/yard/to_mkdocs/default/tags/html/example.erb +13 -0
  105. data/lib/yard/to_mkdocs/default/tags/html/index.erb +2 -0
  106. data/lib/yard/to_mkdocs/default/tags/html/option.erb +13 -0
  107. data/lib/yard/to_mkdocs/default/tags/html/overload.erb +11 -0
  108. data/lib/yard/to_mkdocs/default/tags/html/see.erb +7 -0
  109. data/lib/yard/to_mkdocs/default/tags/html/tag.erb +6 -0
  110. data/lib/yard/to_mkdocs/default/tags/setup.rb +57 -0
  111. data/lib/yard/to_mkdocs/default/tags/text/example.erb +12 -0
  112. data/lib/yard/to_mkdocs/default/tags/text/index.erb +1 -0
  113. data/lib/yard/to_mkdocs/default/tags/text/option.erb +20 -0
  114. data/lib/yard/to_mkdocs/default/tags/text/overload.erb +19 -0
  115. data/lib/yard/to_mkdocs/default/tags/text/see.erb +11 -0
  116. data/lib/yard/to_mkdocs/default/tags/text/tag.erb +13 -0
  117. data/lib/yard/to_mkdocs/version.rb +7 -0
  118. data/lib/yard-to_mkdocs.rb +19 -0
  119. data/yard-to_mkdocs.gemspec +36 -0
  120. metadata +177 -0
@@ -0,0 +1,184 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'yaml'
4
+
5
+ include Helpers::ModuleHelper
6
+
7
+ def init
8
+ options.serializer.basepath = 'docs/yard_docs'
9
+ options.serializer.extension = 'md'
10
+
11
+ options.objects = objects = run_verifier(options.objects)
12
+
13
+ return serialize_onefile if options.onefile
14
+ options.files.each_with_index do |file, _i|
15
+ serialize_file(file, file.title)
16
+ end
17
+
18
+ options.delete(:objects)
19
+ options.delete(:files)
20
+
21
+ objects.each do |object|
22
+ begin
23
+ serialize(object)
24
+ rescue => e
25
+ path = options.serializer.serialized_path(object)
26
+ log.error "Exception occurred while generating '#{path}'"
27
+ log.backtrace(e)
28
+ end
29
+ end
30
+
31
+ mkdocs_file_path = File.expand_path('../../mkdocs.yml', options.serializer.basepath)
32
+ if File.exists?(mkdocs_file_path)
33
+ mkdocs_yaml = YAML.load_file(mkdocs_file_path)
34
+ mkdocs_nav = mkdocs_yaml['nav'].reject { |item| item["YARD Docs"] }
35
+ mkdocs_yaml['nav'] = mkdocs_nav + [{ "YARD Docs" => mkdocs_nav_tree(objects.first) }]
36
+ File.open(mkdocs_file_path, 'w') { |f| f.write(mkdocs_yaml.to_yaml) }
37
+ end
38
+ end
39
+
40
+ def mkdocs_nav_tree(current_object, current_path = "yard_docs")
41
+ return unless [:root, :class, :module].include?(current_object.type)
42
+
43
+ name = current_object.name
44
+ data = if current_object.children.any?
45
+ next_path = current_object.type == :root ? current_path : "#{current_path}/#{name}"
46
+ { name.to_s => ["#{current_path}/#{name}.md", *current_object.children.map { |child| mkdocs_nav_tree(child, next_path) }].compact }
47
+ else
48
+ { name.to_s => "#{current_path}/#{name}.md" }
49
+ end
50
+
51
+ if current_object.type == :root
52
+ data['root'][1..-1]
53
+ else
54
+ data
55
+ end
56
+ end
57
+
58
+ # Generate an HTML document for the specified object. This method is used by
59
+ # most of the objects found in the Registry.
60
+ # @param [CodeObject] object to be saved to HTML
61
+ def serialize(object)
62
+ options.object = object
63
+ serialize_index(options) if object == '_index.md' && options.readme.nil?
64
+ Templates::Engine.with_serializer(object, options.serializer) do
65
+ T('layout').run(options)
66
+ end
67
+ end
68
+
69
+ # Generate the documentation output in one file (--one-file) which will load the
70
+ # contents of all the javascript and css and output the entire contents without
71
+ # depending on any additional files
72
+ def serialize_onefile
73
+ Templates::Engine.with_serializer('index.md', options.serializer) do
74
+ T('onefile').run(options)
75
+ end
76
+ end
77
+
78
+ # Generate the index document for the output
79
+ # @params [Hash] options contains data and flags that influence the output
80
+ def serialize_index(options)
81
+ Templates::Engine.with_serializer('index.md', options.serializer) do
82
+ T('layout').run(options.merge(:index => true))
83
+ end
84
+ end
85
+
86
+ # Generate a single HTML file with the layout template applied. This is generally
87
+ # the README file or files specified on the command-line.
88
+ #
89
+ # @param [File] file object to be saved to the output
90
+ # @param [String] title currently unused
91
+ #
92
+ # @see layout#diskfile
93
+ def serialize_file(file, title = nil) # rubocop:disable Lint/UnusedMethodArgument
94
+ options.object = Registry.root
95
+ options.file = file
96
+ # outfile = 'file.' + file.name + '.md'
97
+
98
+ serialize_index(options) if file == options.readme
99
+ # Templates::Engine.with_serializer(outfile, options.serializer) do
100
+ # T('layout').run(options)
101
+ # end
102
+ options.delete(:file)
103
+ end
104
+
105
+ #
106
+ # Generates a file to the output with the specified contents.
107
+ #
108
+ # @example saving a custom html file to the documentation root
109
+ #
110
+ # asset('my_custom.md','## Custom File')
111
+ #
112
+ # @param [String] path relative to the document output where the file will be
113
+ # created.
114
+ # @param [String] content the contents that are saved to the file.
115
+ def asset(path, content)
116
+ if options.serializer
117
+ log.capture("Generating asset #{path}") do
118
+ options.serializer.serialize(path, content)
119
+ end
120
+ end
121
+ end
122
+
123
+ def menu_lists
124
+ Object.new.extend(T('layout')).menu_lists
125
+ end
126
+
127
+ # Generate a searchable method list in the output
128
+ # @see ModuleHelper#prune_method_listing
129
+ def generate_method_list; end
130
+
131
+ # Generate a searchable class list in the output
132
+ def generate_class_list; end
133
+
134
+ # Generate a searchable file list in the output
135
+ def generate_file_list; end
136
+
137
+ def generate_list_contents; end
138
+
139
+ # Generate the frame documentation in the output
140
+ def generate_frameset; end
141
+
142
+ # @api private
143
+ class TreeContext
144
+ def initialize
145
+ @depth = 0
146
+ @even_odd = Alternator.new(:even, :odd)
147
+ end
148
+
149
+ def nest
150
+ @depth += 1
151
+ yield
152
+ @depth -= 1
153
+ end
154
+
155
+ # @return [String] Returns a css pixel offset, e.g. "30px"
156
+ def indent
157
+ "#{(@depth + 2) * 15}px"
158
+ end
159
+
160
+ def classes
161
+ classes = []
162
+ classes << 'collapsed' if @depth > 0
163
+ classes << @even_odd.next if @depth < 2
164
+ classes
165
+ end
166
+
167
+ class Alternator
168
+ def initialize(first, second)
169
+ @next = first
170
+ @after = second
171
+ end
172
+
173
+ def next
174
+ @next, @after = @after, @next
175
+ @after
176
+ end
177
+ end
178
+ end
179
+
180
+ # @return [String] HTML output of the classes to be displayed in the
181
+ # full_list_class template.
182
+ def class_list(root = Registry.root, tree = TreeContext.new)
183
+ ""
184
+ end
@@ -0,0 +1,6 @@
1
+ digraph yard {
2
+ graph [rankdir=BT rank=sink outputMode=nodesfirst packMode="graph" splines=true];
3
+ node [shape=record rank=sink rankType=sink];
4
+
5
+ <%= yieldall %>
6
+ }
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+ attr_reader :contents
3
+
4
+ def init
5
+ if object
6
+ type = object.root? ? :module : object.type
7
+ sections :header, [T(type)]
8
+ else
9
+ sections :header, [:contents]
10
+ end
11
+ end
12
+
13
+ def header
14
+ tidy erb(:header)
15
+ end
File without changes
File without changes
@@ -0,0 +1,3 @@
1
+ # <%= options.title %>
2
+
3
+ <%= yieldall %>
@@ -0,0 +1 @@
1
+ <%= yieldall %>
File without changes
@@ -0,0 +1,87 @@
1
+ # frozen_string_literal: true
2
+ def init
3
+ @breadcrumb = []
4
+ @page_title = ''
5
+ @breadcrumb_title = ''
6
+ if @onefile
7
+ sections :layout
8
+ elsif defined?(@file) && @file
9
+ if @file.attributes[:namespace]
10
+ @object = options.object = Registry.at(@file.attributes[:namespace]) || Registry.root
11
+ end
12
+ @breadcrumb_title = "File: " + @file.title
13
+ @page_title = @breadcrumb_title
14
+ sections :layout, [:diskfile]
15
+ elsif @contents
16
+ sections :layout, [:contents]
17
+ else
18
+ case object
19
+ when '_index.md'
20
+ @page_title = options.title
21
+ sections :layout, [:index, [:listing, [:files, :objects]]]
22
+ when CodeObjects::Base
23
+ unless object.root?
24
+ cur = object.namespace
25
+ until cur.root?
26
+ @breadcrumb.unshift(cur)
27
+ cur = cur.namespace
28
+ end
29
+ end
30
+
31
+ @page_title = format_object_title(object)
32
+ type = object.root? ? :module : object.type
33
+ sections :layout, [T(type)]
34
+ end
35
+ end
36
+ end
37
+
38
+ attr_reader :contents
39
+
40
+ def index
41
+ @objects_by_letter = {}
42
+ objects = Registry.all(:class, :module).sort_by {|o| o.name.to_s }
43
+ objects = run_verifier(objects)
44
+ objects.each {|o| (@objects_by_letter[o.name.to_s[0, 1].upcase] ||= []) << o }
45
+ erb(:index)
46
+ end
47
+
48
+ def layout
49
+ @path =
50
+ if !object || object.is_a?(String)
51
+ nil
52
+ elsif defined?(@file) && @file
53
+ @file.path
54
+ elsif !object.is_a?(YARD::CodeObjects::NamespaceObject)
55
+ object.parent.path
56
+ else
57
+ object.path
58
+ end
59
+
60
+ erb(:layout)
61
+ end
62
+
63
+ def diskfile
64
+ @file.attributes[:markup] ||= markup_for_file('', @file.filename)
65
+ data = htmlify(@file.contents, @file.attributes[:markup])
66
+ "<div id='filecontents'>" + data + "</div>"
67
+ end
68
+
69
+ # @return [Array<String>] core javascript files for layout
70
+ # @since 0.7.0
71
+ def javascripts
72
+ []
73
+ end
74
+
75
+ # @return [Array<String>] core stylesheets for the layout
76
+ # @since 0.7.0
77
+ def stylesheets
78
+ []
79
+ end
80
+
81
+ # @return [Array<Hash{Symbol=>String}>] the list of search links and drop-down menus
82
+ # @since 0.7.0
83
+ def menu_lists
84
+ [{:type => 'class', :title => 'Classes', :search_title => 'Class List'},
85
+ {:type => 'method', :title => 'Methods', :search_title => 'Method List'},
86
+ {:type => 'file', :title => 'Files', :search_title => 'File List'}]
87
+ end
@@ -0,0 +1,5 @@
1
+ ## Method: <%= object.path %>
2
+
3
+ ** Defined in:** <%= [object.file, *object.files].join(", ") %>
4
+
5
+ <%= yieldall :index => 0 %>
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+ def init
3
+ sections :header, [T('method_details')]
4
+ end
@@ -0,0 +1 @@
1
+ <%= yieldall %>
@@ -0,0 +1 @@
1
+ <%= yieldall %>
@@ -0,0 +1,9 @@
1
+ ### <% if object.tags(:overload).size == 1 %><%= signature(object.tag(:overload), false) %><% elsif object.tags(:overload).size > 1 %><% object.tags(:overload).each do |overload| %><%= signature(overload, false) %><% end %><% else %><%= signature(object, false) %><% end %>
2
+
3
+ <% if object.aliases.size > 0 %>
4
+ **Also known as:** <%= object.aliases.map(&:name).join(", ") %>
5
+ <% end%>
6
+
7
+ <% if owner != object.namespace %>
8
+ _Originally defined in <%= object.namespace.type %>_
9
+ <% end %>
@@ -0,0 +1,5 @@
1
+
2
+ ** File '<%= object.file %>' <% if object.line %>, line <%= object.line %><% end %>**
3
+ ```ruby
4
+ <%= object.source %>
5
+ ```
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+ def init
3
+ sections :header, [:method_signature, T('docstring'), :source]
4
+ end
5
+
6
+ def source
7
+ return if owner != object.namespace
8
+ return if Tags::OverloadTag === object
9
+ return if object.source.nil?
10
+ erb(:source)
11
+ 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,11 @@
1
+ # frozen_string_literal: true
2
+ def init
3
+ super
4
+ sections.last.pop
5
+ end
6
+
7
+ def format_object_title(object)
8
+ title = "Method: #{object.name(true)}"
9
+ title += " (#{object.namespace})" unless object.namespace.root?
10
+ title
11
+ 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,15 @@
1
+ # frozen_string_literal: true
2
+ def init
3
+ @modules = object.children.select {|o| o.type == :module }
4
+ @classes = object.children.select {|o| o.type == :class }
5
+ sections :child, [:info], :classes, [T('class')], :header, [T('module')], :dependencies
6
+ end
7
+
8
+ def dependencies
9
+ return unless options.dependencies
10
+ erb(:dependencies)
11
+ end
12
+
13
+ def classes
14
+ @classes.map {|k| yieldall :object => k }.join("\n")
15
+ end
@@ -0,0 +1,7 @@
1
+ <% scopes(attr_listing) do |list, scope| %>
2
+ ## <%= scope.to_s.capitalize %> Attribute Details
3
+
4
+ <% list.each_with_index do |meth, i| %>
5
+ <%= yieldall :object => meth, :owner => object, :index => i %>
6
+ <% end %>
7
+ <% end %>
@@ -0,0 +1,7 @@
1
+ <% groups(attr_listing, "Attribute") do |list, name| %>
2
+ ## <%= name %>
3
+
4
+ <% list.each do |meth| %>
5
+ <%= yieldall :item => meth %>
6
+ <% end %>
7
+ <% end %>
@@ -0,0 +1,14 @@
1
+ <% if CodeObjects::ClassObject === object && object.superclass %>
2
+ **Inherits:** <%= linkify object.superclass %>
3
+ <% end %>
4
+ <% [[:class, "Extended by"], [:instance, "Includes"]].each do |scope, name| %>
5
+ <% if (mix = run_verifier(object.mixins(scope))).size > 0 %>
6
+ **<%= name %>:** <%= mix.sort_by {|o| o.path }.map {|o| linkify(o) }.join(", ") %>
7
+ <% end %>
8
+ <% end %>
9
+ <% if (mixed_into = mixed_into(object)).size > 0 %>
10
+ **Included in:** <%= mixed_into.sort_by {|o| o.path }.map {|o| linkify(o) }.join(", ") %>
11
+ <% end %>
12
+ <% unless object.root? %>
13
+ **Defined in:** <%= erb(:defines) %>
14
+ <% end %>
@@ -0,0 +1,7 @@
1
+ ## Defined Under Namespace
2
+
3
+ <% @inner.each do |name, list| %>
4
+ <% if list.size > 0 %>
5
+ **<%= name.to_s.capitalize %>:** <%= list.map {|child| linkify(child, child.name(true)) }.join(", ") %>
6
+ <% end %>
7
+ <% end %>
@@ -0,0 +1,13 @@
1
+ <% if constant_listing.size > 0 %>
2
+ <% groups(constant_listing, "Constant") do |list, name| %>
3
+ ## <%= name %>
4
+
5
+ <% list.each do |cnst| %>
6
+ <%= cnst.has_tag?(:deprecated) ? '~' : '' %><%= cnst.name %> = <%= yieldall :item => cnst %><%= cnst.has_tag?(:deprecated) ? '~' : '' %>
7
+
8
+ ```ruby
9
+ <%= cnst.value %>
10
+ ```
11
+ <% end %>
12
+ <% end %>
13
+ <% end %>
@@ -0,0 +1 @@
1
+ <%= [object.file || '(unknown)', *object.files.map(&:first)].join(', ') %>
@@ -0,0 +1 @@
1
+ # <%= format_object_title(object) %><% if object.has_tag?(:abstract) %> Abstract<% end %><% if object.has_tag?(:deprecated) %> Deprecated<% end %><% if object.has_tag?(:api) && object.tag(:api).text == 'private' %> Private<% end %>
@@ -0,0 +1,16 @@
1
+ <% found_method = false %>
2
+ <% inherited_attr_list do |superclass, attribs| %>
3
+ <% if attr_listing.size == 0 && !found_method %>## Instance Attribute Summary<% end %>
4
+ <% found_method = true %>
5
+ ### Attributes <%= superclass.type == :class ? 'inherited' : 'included' %> from <%= superclass %>
6
+
7
+ <%=
8
+ attribs.map do |method|
9
+ name = method.name(true).gsub(/=$/, '')
10
+ if superclass.type == :module && object.instance_mixins.include?(superclass)
11
+ name = "##{name}" unless name =~ /^#/
12
+ end
13
+ linkify(method, name)
14
+ end.join(", ")
15
+ %>
16
+ <% end %>
@@ -0,0 +1,11 @@
1
+ <% found_const = false %>
2
+ <% inherited_constant_list do |superclass, consts| %>
3
+ <% if constant_listing.size == 0 && !found_const %>
4
+ ## Constant Summary
5
+ <% end %>
6
+ <% found_const = true %>
7
+
8
+ ### Constants <%= superclass.type == :class ? 'inherited' : 'included' %>from <%= superclass %>
9
+
10
+ <%= consts.map {|c| linkify c }.join(", ") %>
11
+ <% end %>
@@ -0,0 +1,22 @@
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 %>
10
+ ## Method Summary
11
+ <% end %>
12
+ <% found_method = true %>
13
+ ### Methods <%= superclass.type == :class ? 'inherited' : 'included' %> from <%= linkify superclass %>
14
+
15
+ <%=
16
+ meths.sort_by {|o| o.name.to_s }.map do |m|
17
+ name = m.name(true)
18
+ name = name.gsub(/^#/,'') if superclass.type == :module && object.class_mixins.include?(superclass)
19
+ linkify(m, name)
20
+ end.join(", ")
21
+ %>
22
+ <% end %>
@@ -0,0 +1,16 @@
1
+ * <% if @item.tags(:overload).size == 1 %><%= signature(@item.tag(:overload), true, false, !@item.attr_info) %><% else %><%= signature(@item, true, false, !@item.attr_info) %><% end %><% if @item.aliases.size > 0 %>(also: <%= @item.aliases.map {|o| h(o.name(true)) }.join(", ") %>)<% end %>
2
+ <% if object != @item.namespace %><%= @item.namespace.type == :class ? 'inherited' : (@item.scope == :class ? 'extended' : 'included') %>from <%= linkify @item, object.relative_path(@item.namespace) %><% end %>
3
+ <% if @item.constructor? %>constructor<% end %>
4
+ <% if rw = @item.attr_info %>
5
+ <% if !run_verifier([rw[:read]].compact).empty? && run_verifier([rw[:write]].compact).empty? %>readonly<% end %>
6
+ <% if !run_verifier([rw[:write]].compact).empty? && run_verifier([rw[:read]].compact).empty? %>writeonly<% end %>
7
+ <% end %>
8
+ <% if @item.visibility != :public %><%= @item.visibility %><% end %>
9
+ <% if @item.has_tag?(:abstract) %>abstract<% end %>
10
+ <% if @item.has_tag?(:deprecated) %>deprecated<% end %>
11
+ <% if @item.has_tag?(:api) && @item.tag(:api).text == 'private' %>private<% end %>
12
+ <% if @item.has_tag?(:deprecated) %>
13
+ **Deprecated.** <%= @item.tag(:deprecated).text %>
14
+ <% else %>
15
+ <%= docstring_summary(@item) %>
16
+ <% end %>
@@ -0,0 +1,7 @@
1
+ <% scopes(method_listing(false)) do |list, scope| %>
2
+ ## <%= scope.to_s.capitalize %> Method Details
3
+
4
+ <% list.each_with_index do |meth, i| %>
5
+ <%= yieldall :object => meth, :owner => object, :index => i %>
6
+ <% end %>
7
+ <% end %>
@@ -0,0 +1,9 @@
1
+ <% if method_listing.size > 0 %>
2
+ <% groups(method_listing) do |list, name| %>
3
+ ## <%= name %>
4
+
5
+ <% list.each do |meth| %>
6
+ <%= yieldall :item => meth %>
7
+ <% end %>
8
+ <% end %>
9
+ <% end %>
@@ -0,0 +1,10 @@
1
+ ## Dynamic Method Handling
2
+
3
+ This class handles dynamic methods through the `method_missing` method
4
+ <% if @mm.namespace != object %>
5
+ in the class <%= linkify @mm, @mm.namespace.path %>
6
+ <% end %>
7
+
8
+ <% if @mm.namespace == object %>
9
+ <%= yieldall :object => @mm, :index => 0 %>
10
+ <% end %>