rdoc 7.2.0 → 8.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 (150) hide show
  1. checksums.yaml +4 -4
  2. data/CONTRIBUTING.md +4 -7
  3. data/LICENSE.rdoc +4 -0
  4. data/README.md +43 -2
  5. data/RI.md +75 -75
  6. data/doc/markup_reference/markdown.md +104 -3
  7. data/exe/rdoc +2 -2
  8. data/lib/rdoc/code_object/alias.rb +70 -74
  9. data/lib/rdoc/code_object/any_method.rb +305 -298
  10. data/lib/rdoc/code_object/attr.rb +150 -143
  11. data/lib/rdoc/code_object/class_module.rb +801 -765
  12. data/lib/rdoc/code_object/constant.rb +178 -150
  13. data/lib/rdoc/code_object/context/section.rb +133 -160
  14. data/lib/rdoc/code_object/context.rb +925 -952
  15. data/lib/rdoc/code_object/extend.rb +7 -5
  16. data/lib/rdoc/code_object/include.rb +7 -5
  17. data/lib/rdoc/code_object/method_attr.rb +325 -324
  18. data/lib/rdoc/code_object/mixin.rb +97 -95
  19. data/lib/rdoc/code_object/normal_class.rb +77 -78
  20. data/lib/rdoc/code_object/normal_module.rb +61 -59
  21. data/lib/rdoc/code_object/require.rb +23 -39
  22. data/lib/rdoc/code_object/single_class.rb +21 -19
  23. data/lib/rdoc/code_object/top_level.rb +212 -213
  24. data/lib/rdoc/code_object.rb +305 -305
  25. data/lib/rdoc/comment.rb +274 -337
  26. data/lib/rdoc/cross_reference.rb +194 -212
  27. data/lib/rdoc/encoding.rb +105 -103
  28. data/lib/rdoc/erb_partial.rb +13 -11
  29. data/lib/rdoc/erbio.rb +29 -27
  30. data/lib/rdoc/generator/aliki.rb +165 -140
  31. data/lib/rdoc/generator/darkfish.rb +647 -631
  32. data/lib/rdoc/generator/json_index.rb +233 -229
  33. data/lib/rdoc/generator/markup.rb +165 -122
  34. data/lib/rdoc/generator/pot/message_extractor.rb +57 -51
  35. data/lib/rdoc/generator/pot/po.rb +52 -51
  36. data/lib/rdoc/generator/pot/po_entry.rb +138 -132
  37. data/lib/rdoc/generator/pot.rb +85 -81
  38. data/lib/rdoc/generator/ri.rb +23 -19
  39. data/lib/rdoc/generator/template/aliki/DESIGN.md +538 -0
  40. data/lib/rdoc/generator/template/aliki/_aside_toc.rhtml +1 -1
  41. data/lib/rdoc/generator/template/aliki/_footer.rhtml +1 -1
  42. data/lib/rdoc/generator/template/aliki/_head.rhtml +11 -11
  43. data/lib/rdoc/generator/template/aliki/_header.rhtml +29 -44
  44. data/lib/rdoc/generator/template/aliki/_sidebar_extends.rhtml +8 -6
  45. data/lib/rdoc/generator/template/aliki/_sidebar_includes.rhtml +8 -6
  46. data/lib/rdoc/generator/template/aliki/_sidebar_installed.rhtml +1 -1
  47. data/lib/rdoc/generator/template/aliki/_sidebar_pages.rhtml +2 -2
  48. data/lib/rdoc/generator/template/aliki/_sidebar_search.rhtml +4 -4
  49. data/lib/rdoc/generator/template/aliki/_sidebar_sections.rhtml +1 -1
  50. data/lib/rdoc/generator/template/aliki/_sidebar_toggle.rhtml +1 -1
  51. data/lib/rdoc/generator/template/aliki/class.rhtml +56 -46
  52. data/lib/rdoc/generator/template/aliki/css/rdoc.css +538 -283
  53. data/lib/rdoc/generator/template/aliki/index.rhtml +1 -1
  54. data/lib/rdoc/generator/template/aliki/js/aliki.js +80 -102
  55. data/lib/rdoc/generator/template/aliki/page.rhtml +1 -1
  56. data/lib/rdoc/generator/template/aliki/servlet_not_found.rhtml +1 -1
  57. data/lib/rdoc/generator/template/aliki/servlet_root.rhtml +2 -2
  58. data/lib/rdoc/generator/template/darkfish/_footer.rhtml +1 -1
  59. data/lib/rdoc/generator/template/darkfish/_sidebar_extends.rhtml +8 -6
  60. data/lib/rdoc/generator/template/darkfish/_sidebar_includes.rhtml +8 -6
  61. data/lib/rdoc/generator/template/darkfish/_sidebar_installed.rhtml +1 -1
  62. data/lib/rdoc/generator/template/darkfish/_sidebar_pages.rhtml +1 -1
  63. data/lib/rdoc/generator/template/darkfish/_sidebar_sections.rhtml +1 -1
  64. data/lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml +5 -5
  65. data/lib/rdoc/generator/template/darkfish/class.rhtml +18 -21
  66. data/lib/rdoc/generator/template/darkfish/css/rdoc.css +0 -1
  67. data/lib/rdoc/generator/template/darkfish/table_of_contents.rhtml +3 -3
  68. data/lib/rdoc/generator.rb +48 -46
  69. data/lib/rdoc/i18n/locale.rb +99 -95
  70. data/lib/rdoc/i18n/text.rb +109 -105
  71. data/lib/rdoc/i18n.rb +7 -5
  72. data/lib/rdoc/markdown/byte_runtime.rb +80 -0
  73. data/lib/rdoc/markdown.kpeg +30 -21
  74. data/lib/rdoc/markdown.rb +329 -151
  75. data/lib/rdoc/markup/block_quote.rb +12 -8
  76. data/lib/rdoc/markup/document.rb +127 -123
  77. data/lib/rdoc/markup/formatter.rb +215 -221
  78. data/lib/rdoc/markup/heading.rb +1 -4
  79. data/lib/rdoc/markup/include.rb +33 -29
  80. data/lib/rdoc/markup/indented_paragraph.rb +37 -33
  81. data/lib/rdoc/markup/inline_parser.rb +281 -277
  82. data/lib/rdoc/markup/list.rb +80 -88
  83. data/lib/rdoc/markup/list_item.rb +73 -85
  84. data/lib/rdoc/markup/paragraph.rb +23 -19
  85. data/lib/rdoc/markup/parser.rb +501 -497
  86. data/lib/rdoc/markup/pre_process.rb +284 -305
  87. data/lib/rdoc/markup/raw.rb +2 -2
  88. data/lib/rdoc/markup/rule.rb +16 -12
  89. data/lib/rdoc/markup/to_ansi.rb +143 -139
  90. data/lib/rdoc/markup/to_bs.rb +72 -68
  91. data/lib/rdoc/markup/to_html.rb +600 -493
  92. data/lib/rdoc/markup/to_html_crossref.rb +221 -191
  93. data/lib/rdoc/markup/to_html_snippet.rb +232 -227
  94. data/lib/rdoc/markup/to_joined_paragraph.rb +40 -41
  95. data/lib/rdoc/markup/to_label.rb +63 -59
  96. data/lib/rdoc/markup/to_markdown.rb +212 -208
  97. data/lib/rdoc/markup/to_rdoc.rb +336 -332
  98. data/lib/rdoc/markup/to_table_of_contents.rb +66 -62
  99. data/lib/rdoc/markup/to_test.rb +60 -56
  100. data/lib/rdoc/markup/to_tt_only.rb +83 -86
  101. data/lib/rdoc/markup/verbatim.rb +62 -58
  102. data/lib/rdoc/markup.rb +198 -196
  103. data/lib/rdoc/options.rb +1063 -1076
  104. data/lib/rdoc/parser/c.rb +1039 -1036
  105. data/lib/rdoc/parser/changelog.rb +319 -315
  106. data/lib/rdoc/parser/markdown.rb +17 -13
  107. data/lib/rdoc/parser/rbs.rb +279 -0
  108. data/lib/rdoc/parser/rd.rb +17 -13
  109. data/lib/rdoc/parser/ruby.rb +1231 -2222
  110. data/lib/rdoc/parser/ruby_colorizer.rb +303 -0
  111. data/lib/rdoc/parser/simple.rb +31 -27
  112. data/lib/rdoc/parser/text.rb +12 -8
  113. data/lib/rdoc/parser.rb +230 -221
  114. data/lib/rdoc/rbs_helper.rb +186 -0
  115. data/lib/rdoc/rd/inline.rb +57 -53
  116. data/lib/rdoc/rd.rb +90 -88
  117. data/lib/rdoc/rdoc.rb +547 -366
  118. data/lib/rdoc/ri/driver.rb +1141 -1130
  119. data/lib/rdoc/ri/formatter.rb +7 -3
  120. data/lib/rdoc/ri/paths.rb +140 -136
  121. data/lib/rdoc/ri/servlet.rb +456 -0
  122. data/lib/rdoc/ri/store.rb +4 -2
  123. data/lib/rdoc/ri/task.rb +55 -51
  124. data/lib/rdoc/ri.rb +14 -11
  125. data/lib/rdoc/rubygems_hook.rb +194 -192
  126. data/lib/rdoc/server.rb +462 -0
  127. data/lib/rdoc/stats/normal.rb +46 -42
  128. data/lib/rdoc/stats/quiet.rb +39 -35
  129. data/lib/rdoc/stats/verbose.rb +35 -31
  130. data/lib/rdoc/stats.rb +363 -338
  131. data/lib/rdoc/store.rb +919 -725
  132. data/lib/rdoc/task.rb +260 -255
  133. data/lib/rdoc/text.rb +130 -245
  134. data/lib/rdoc/token_stream.rb +101 -115
  135. data/lib/rdoc/tom_doc.rb +203 -201
  136. data/lib/rdoc/version.rb +1 -1
  137. data/lib/rdoc.rb +35 -7
  138. data/lib/rubygems_plugin.rb +2 -11
  139. data/rdoc-logo.svg +43 -0
  140. data/rdoc.gemspec +6 -4
  141. metadata +36 -20
  142. data/lib/rdoc/code_object/anon_class.rb +0 -10
  143. data/lib/rdoc/code_object/ghost_method.rb +0 -6
  144. data/lib/rdoc/code_object/meta_method.rb +0 -6
  145. data/lib/rdoc/markdown/literals.kpeg +0 -21
  146. data/lib/rdoc/markdown/literals.rb +0 -454
  147. data/lib/rdoc/parser/prism_ruby.rb +0 -1112
  148. data/lib/rdoc/parser/ripper_state_lex.rb +0 -302
  149. data/lib/rdoc/parser/ruby_tools.rb +0 -163
  150. data/lib/rdoc/servlet.rb +0 -452
@@ -1,18 +1,20 @@
1
1
  # frozen_string_literal: true
2
- ##
3
- # Allows an ERB template to be rendered in the context (binding) of an
4
- # existing ERB template evaluation.
2
+ module RDoc
3
+ ##
4
+ # Allows an ERB template to be rendered in the context (binding) of an
5
+ # existing ERB template evaluation.
5
6
 
6
- class RDoc::ERBPartial < ERB
7
+ class ERBPartial < ERB
7
8
 
8
- ##
9
- # Overrides +compiler+ startup to set the +eoutvar+ to an empty string only
10
- # if it isn't already set.
9
+ ##
10
+ # Overrides +compiler+ startup to set the +eoutvar+ to an empty string only
11
+ # if it isn't already set.
11
12
 
12
- def set_eoutvar(compiler, eoutvar = '_erbout')
13
- super
13
+ def set_eoutvar(compiler, eoutvar = '_erbout')
14
+ super
14
15
 
15
- compiler.pre_cmd = ["#{eoutvar} ||= +''"]
16
- end
16
+ compiler.pre_cmd = ["#{eoutvar} ||= +''"]
17
+ end
17
18
 
19
+ end
18
20
  end
data/lib/rdoc/erbio.rb CHANGED
@@ -1,37 +1,39 @@
1
1
  # frozen_string_literal: true
2
2
  require 'erb'
3
3
 
4
- ##
5
- # A subclass of ERB that writes directly to an IO. Credit to Aaron Patterson
6
- # and Masatoshi SEKI.
7
- #
8
- # To use:
9
- #
10
- # erbio = RDoc::ERBIO.new '<%= "hello world" %>', nil, nil
11
- #
12
- # File.open 'hello.txt', 'w' do |io|
13
- # erbio.result binding
14
- # end
15
- #
16
- # Note that binding must enclose the io you wish to output on.
4
+ module RDoc
5
+ ##
6
+ # A subclass of ERB that writes directly to an IO. Credit to Aaron Patterson
7
+ # and Masatoshi SEKI.
8
+ #
9
+ # To use:
10
+ #
11
+ # erbio = RDoc::ERBIO.new '<%= "hello world" %>', nil, nil
12
+ #
13
+ # File.open 'hello.txt', 'w' do |io|
14
+ # erbio.result binding
15
+ # end
16
+ #
17
+ # Note that binding must enclose the io you wish to output on.
17
18
 
18
- class RDoc::ERBIO < ERB
19
+ class ERBIO < ERB
19
20
 
20
- ##
21
- # Defaults +eoutvar+ to 'io', otherwise is identical to ERB's initialize
21
+ ##
22
+ # Defaults +eoutvar+ to 'io', otherwise is identical to ERB's initialize
22
23
 
23
- def initialize(str, trim_mode: nil, eoutvar: 'io')
24
- super(str, trim_mode: trim_mode, eoutvar: eoutvar)
25
- end
24
+ def initialize(str, trim_mode: nil, eoutvar: 'io')
25
+ super(str, trim_mode: trim_mode, eoutvar: eoutvar)
26
+ end
26
27
 
27
- ##
28
- # Instructs +compiler+ how to write to +io_variable+
28
+ ##
29
+ # Instructs +compiler+ how to write to +io_variable+
29
30
 
30
- def set_eoutvar(compiler, io_variable)
31
- compiler.put_cmd = "#{io_variable}.write"
32
- compiler.insert_cmd = "#{io_variable}.write"
33
- compiler.pre_cmd = []
34
- compiler.post_cmd = []
35
- end
31
+ def set_eoutvar(compiler, io_variable)
32
+ compiler.put_cmd = "#{io_variable}.write"
33
+ compiler.insert_cmd = "#{io_variable}.write"
34
+ compiler.pre_cmd = []
35
+ compiler.post_cmd = []
36
+ end
36
37
 
38
+ end
37
39
  end
@@ -2,182 +2,207 @@
2
2
 
3
3
  require 'uri'
4
4
 
5
- ##
6
- # Aliki theme for RDoc documentation
7
- #
8
- # Author: Stan Lo
9
- #
10
-
11
- class RDoc::Generator::Aliki < RDoc::Generator::Darkfish
12
- RDoc::RDoc.add_generator self
13
-
14
- def initialize(store, options)
15
- super
16
- aliki_template_dir = File.expand_path(File.join(__dir__, 'template', 'aliki'))
17
- @template_dir = Pathname.new(aliki_template_dir)
18
- end
5
+ module RDoc
6
+ module Generator
7
+ ##
8
+ # Aliki theme for RDoc documentation
9
+ #
10
+ # Author: Stan Lo
11
+ #
12
+
13
+ class Aliki < Generator::Darkfish
14
+ DESCRIPTION = 'HTML generator, written by Stan Lo'
15
+
16
+ RDoc.add_generator self
17
+
18
+ def initialize(store, options)
19
+ super
20
+ aliki_template_dir = File.expand_path(File.join(__dir__, 'template', 'aliki'))
21
+ @template_dir = Pathname.new(aliki_template_dir)
22
+ end
19
23
 
20
- ##
21
- # Generate documentation. Overrides Darkfish to use Aliki's own search index
22
- # instead of the JsonIndex generator.
24
+ ##
25
+ # Generate documentation. Overrides Darkfish to use Aliki's own search index
26
+ # instead of the JsonIndex generator.
23
27
 
24
- def generate
25
- setup
28
+ def generate
29
+ setup
26
30
 
27
- write_style_sheet
28
- generate_index
29
- generate_class_files
30
- generate_file_files
31
- generate_table_of_contents
32
- write_search_index
31
+ write_style_sheet
32
+ generate_index
33
+ generate_class_files
34
+ generate_file_files
35
+ generate_table_of_contents
36
+ write_search_index
33
37
 
34
- copy_static
38
+ copy_static
35
39
 
36
- rescue => e
37
- debug_msg "%s: %s\n %s" % [
38
- e.class.name, e.message, e.backtrace.join("\n ")
39
- ]
40
+ rescue => e
41
+ debug_msg "%s: %s\n %s" % [
42
+ e.class.name, e.message, e.backtrace.join("\n ")
43
+ ]
40
44
 
41
- raise
42
- end
45
+ raise
46
+ end
43
47
 
44
- ##
45
- # Copy only the static assets required by the Aliki theme. Unlike Darkfish we
46
- # don't ship embedded fonts or image sprites, so limit the asset list to keep
47
- # generated documentation lightweight.
48
+ ##
49
+ # Copy only the static assets required by the Aliki theme. Unlike Darkfish we
50
+ # don't ship embedded fonts or image sprites, so limit the asset list to keep
51
+ # generated documentation lightweight.
48
52
 
49
- def write_style_sheet
50
- debug_msg "Copying Aliki static files"
51
- options = { verbose: $DEBUG_RDOC, noop: @dry_run }
53
+ def write_style_sheet
54
+ debug_msg "Copying Aliki static files"
55
+ options = { verbose: $DEBUG_RDOC, noop: @dry_run }
52
56
 
53
- install_rdoc_static_file @template_dir + 'css/rdoc.css', "./css/rdoc.css", options
57
+ install_rdoc_static_file @template_dir + 'css/rdoc.css', "./css/rdoc.css", options
54
58
 
55
- unless @options.template_stylesheets.empty?
56
- FileUtils.cp @options.template_stylesheets, '.', **options
57
- end
59
+ unless @options.template_stylesheets.empty?
60
+ FileUtils.cp @options.template_stylesheets, '.', **options
61
+ end
58
62
 
59
- Dir[(@template_dir + 'js/**/*').to_s].each do |path|
60
- next if File.directory?(path)
61
- next if File.basename(path).start_with?('.')
63
+ Dir[(@template_dir + 'js/**/*').to_s].each do |path|
64
+ next if File.directory?(path)
65
+ next if File.basename(path).start_with?('.')
62
66
 
63
- dst = Pathname.new(path).relative_path_from(@template_dir)
67
+ dst = Pathname.new(path).relative_path_from(@template_dir)
64
68
 
65
- install_rdoc_static_file @template_dir + path, dst, options
66
- end
67
- end
69
+ install_rdoc_static_file @template_dir + path, dst, options
70
+ end
71
+ end
72
+
73
+ ##
74
+ # Build a search index array for Aliki's searcher.
75
+
76
+ def build_search_index
77
+ setup
78
+
79
+ index = []
68
80
 
69
- ##
70
- # Build a search index array for Aliki's searcher.
81
+ @classes.each do |klass|
82
+ next unless klass.display?
71
83
 
72
- def build_search_index
73
- setup
84
+ index << build_class_module_entry(klass)
74
85
 
75
- index = []
86
+ klass.constants.each do |const|
87
+ next unless const.display?
76
88
 
77
- @classes.each do |klass|
78
- next unless klass.display?
89
+ index << build_constant_entry(const, klass)
90
+ end
91
+ end
79
92
 
80
- index << build_class_module_entry(klass)
93
+ @methods.each do |method|
94
+ next unless method.display?
81
95
 
82
- klass.constants.each do |const|
83
- next unless const.display?
96
+ index << build_method_entry(method)
97
+ end
84
98
 
85
- index << build_constant_entry(const, klass)
99
+ index
86
100
  end
87
- end
88
101
 
89
- @methods.each do |method|
90
- next unless method.display?
102
+ ##
103
+ # Write the search index as a JavaScript file
104
+ # Format: var search_data = { index: [...] }
105
+ #
106
+ # We still write to a .js instead of a .json because loading a JSON file triggers CORS check in browsers.
107
+ # And if we simply inspect the generated pages using file://, which is often the case due to lack of the server mode,
108
+ # the JSON file will be blocked by the browser.
91
109
 
92
- index << build_method_entry(method)
93
- end
110
+ def write_search_index
111
+ debug_msg "Writing Aliki search index"
94
112
 
95
- index
96
- end
113
+ index = build_search_index
97
114
 
98
- ##
99
- # Write the search index as a JavaScript file
100
- # Format: var search_data = { index: [...] }
101
- #
102
- # We still write to a .js instead of a .json because loading a JSON file triggers CORS check in browsers.
103
- # And if we simply inspect the generated pages using file://, which is often the case due to lack of the server mode,
104
- # the JSON file will be blocked by the browser.
115
+ FileUtils.mkdir_p 'js' unless @dry_run
105
116
 
106
- def write_search_index
107
- debug_msg "Writing Aliki search index"
117
+ search_index_path = 'js/search_data.js'
118
+ return if @dry_run
108
119
 
109
- index = build_search_index
120
+ data = { index: index }
121
+ File.write search_index_path, "var search_data = #{JSON.generate(data)};"
122
+ end
110
123
 
111
- FileUtils.mkdir_p 'js' unless @dry_run
124
+ ##
125
+ # Returns the type signature of +method_attr+ as HTML with linked type names.
126
+ # Returns nil if no type signature is present.
112
127
 
113
- search_index_path = 'js/search_data.js'
114
- return if @dry_run
128
+ def type_signature_html(method_attr, from_path)
129
+ lines = method_attr.type_signature_lines || @store.rbs_signature_for(method_attr)
130
+ return unless lines
115
131
 
116
- data = { index: index }
117
- File.write search_index_path, "var search_data = #{JSON.generate(data)};"
118
- end
132
+ RbsHelper.signature_to_html(
133
+ lines,
134
+ lookup: @store.type_name_lookup,
135
+ from_path: from_path
136
+ )
137
+ end
119
138
 
120
- ##
121
- # Resolves a URL for use in templates. Absolute URLs are returned unchanged.
122
- # Relative URLs are prefixed with rel_prefix to ensure they resolve correctly from any page.
139
+ ##
140
+ # Resolves a URL for use in templates. Absolute URLs are returned unchanged.
141
+ # Relative URLs are prefixed with rel_prefix to ensure they resolve correctly from any page.
142
+
143
+ def resolve_url(rel_prefix, url)
144
+ uri = URI.parse(url)
145
+ if uri.absolute?
146
+ url
147
+ else
148
+ "#{rel_prefix}/#{url}"
149
+ end
150
+ rescue URI::InvalidURIError
151
+ "#{rel_prefix}/#{url}"
152
+ end
123
153
 
124
- def resolve_url(rel_prefix, url)
125
- uri = URI.parse(url)
126
- if uri.absolute?
127
- url
128
- else
129
- "#{rel_prefix}/#{url}"
130
- end
131
- rescue URI::InvalidURIError
132
- "#{rel_prefix}/#{url}"
133
- end
154
+ private
134
155
 
135
- private
136
-
137
- def build_class_module_entry(klass)
138
- type = case klass
139
- when RDoc::NormalClass then 'class'
140
- when RDoc::NormalModule then 'module'
141
- else 'class'
142
- end
143
-
144
- entry = {
145
- name: klass.name,
146
- full_name: klass.full_name,
147
- type: type,
148
- path: klass.path
149
- }
150
-
151
- snippet = klass.search_snippet
152
- entry[:snippet] = snippet unless snippet.empty?
153
- entry
154
- end
156
+ def template_encoding
157
+ ::Encoding::UTF_8
158
+ end
155
159
 
156
- def build_method_entry(method)
157
- type = method.singleton ? 'class_method' : 'instance_method'
160
+ def build_class_module_entry(klass)
161
+ type = case klass
162
+ when NormalClass then 'class'
163
+ when NormalModule then 'module'
164
+ else 'class'
165
+ end
166
+
167
+ entry = {
168
+ name: klass.name,
169
+ full_name: klass.full_name,
170
+ type: type,
171
+ path: klass.path
172
+ }
173
+
174
+ snippet = klass.search_snippet
175
+ entry[:snippet] = snippet unless snippet.empty?
176
+ entry
177
+ end
158
178
 
159
- entry = {
160
- name: method.name,
161
- full_name: method.full_name,
162
- type: type,
163
- path: method.path
164
- }
179
+ def build_method_entry(method)
180
+ type = method.singleton ? 'class_method' : 'instance_method'
165
181
 
166
- snippet = method.search_snippet
167
- entry[:snippet] = snippet unless snippet.empty?
168
- entry
169
- end
182
+ entry = {
183
+ name: method.name,
184
+ full_name: method.full_name,
185
+ type: type,
186
+ path: method.path
187
+ }
170
188
 
171
- def build_constant_entry(const, parent)
172
- entry = {
173
- name: const.name,
174
- full_name: "#{parent.full_name}::#{const.name}",
175
- type: 'constant',
176
- path: parent.path
177
- }
178
-
179
- snippet = const.search_snippet
180
- entry[:snippet] = snippet unless snippet.empty?
181
- entry
189
+ snippet = method.search_snippet
190
+ entry[:snippet] = snippet unless snippet.empty?
191
+ entry
192
+ end
193
+
194
+ def build_constant_entry(const, parent)
195
+ entry = {
196
+ name: const.name,
197
+ full_name: "#{parent.full_name}::#{const.name}",
198
+ type: 'constant',
199
+ path: parent.path
200
+ }
201
+
202
+ snippet = const.search_snippet
203
+ entry[:snippet] = snippet unless snippet.empty?
204
+ entry
205
+ end
206
+ end
182
207
  end
183
208
  end