Skip to content

Commit 4538427

Browse files
committed
Remove search_record methods from code objects
These methods were only used by the now-removed JsonIndex generator. Each had a TODO comment noting they should be removed after dropping Darkfish/JsonIndex. The Aliki search index uses search_snippet instead. - Remove ClassModule#search_record - Remove TopLevel#search_record - Remove MethodAttr#search_record - Remove corresponding tests
1 parent 585de51 commit 4538427

7 files changed

Lines changed: 0 additions & 152 deletions

File tree

lib/rdoc/code_object/class_module.rb

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -723,24 +723,6 @@ def remove_things(my_things, other_files) # :nodoc:
723723
end
724724
end
725725

726-
##
727-
# Search record used by RDoc::Generator::JsonIndex
728-
#
729-
# TODO: Remove this method after dropping the darkfish theme and JsonIndex generator.
730-
# Use #search_snippet instead for getting documentation snippets.
731-
732-
def search_record
733-
[
734-
name,
735-
full_name,
736-
full_name,
737-
'',
738-
path,
739-
'',
740-
snippet(@comment_location),
741-
]
742-
end
743-
744726
##
745727
# Returns an HTML snippet of the first comment for search results.
746728

lib/rdoc/code_object/method_attr.rb

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -372,25 +372,6 @@ def pretty_print(q) # :nodoc:
372372
end
373373
end
374374

375-
##
376-
# Used by RDoc::Generator::JsonIndex to create a record for the search
377-
# engine.
378-
#
379-
# TODO: Remove this method after dropping the darkfish theme and JsonIndex generator.
380-
# Use #search_snippet instead for getting documentation snippets.
381-
382-
def search_record
383-
[
384-
@name,
385-
full_name,
386-
@name,
387-
@parent.full_name,
388-
path,
389-
params,
390-
search_snippet,
391-
]
392-
end
393-
394375
##
395376
# Returns an HTML snippet of the comment for search results.
396377

lib/rdoc/code_object/top_level.rb

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -243,26 +243,6 @@ def pretty_print(q) # :nodoc:
243243
end
244244
end
245245

246-
##
247-
# Search record used by RDoc::Generator::JsonIndex
248-
#
249-
# TODO: Remove this method after dropping the darkfish theme and JsonIndex generator.
250-
# Use #search_snippet instead for getting documentation snippets.
251-
252-
def search_record
253-
return unless @parser < RDoc::Parser::Text
254-
255-
[
256-
page_name,
257-
'',
258-
page_name,
259-
'',
260-
path,
261-
'',
262-
search_snippet,
263-
]
264-
end
265-
266246
##
267247
# Returns an HTML snippet of the comment for search results.
268248

test/rdoc/code_object/class_module_test.rb

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1251,39 +1251,6 @@ def test_remove_nodoc_children
12511251
assert_equal %w[D], parent.classes_hash.keys
12521252
end
12531253

1254-
def test_search_record
1255-
@c2_c3.add_comment 'This is a comment.', @xref_data
1256-
1257-
expected = [
1258-
'C3',
1259-
'C2::C3',
1260-
'C2::C3',
1261-
'',
1262-
'C2/C3.html',
1263-
'',
1264-
"<p>This is a comment.\n"
1265-
]
1266-
1267-
assert_equal expected, @c2_c3.search_record
1268-
end
1269-
1270-
def test_search_record_merged
1271-
@c2_c3.add_comment 'comment A', @store.add_file('a.rb')
1272-
@c2_c3.add_comment 'comment B', @store.add_file('b.rb')
1273-
1274-
expected = [
1275-
'C3',
1276-
'C2::C3',
1277-
'C2::C3',
1278-
'',
1279-
'C2/C3.html',
1280-
'',
1281-
"<p>comment A\n<p>comment B\n"
1282-
]
1283-
1284-
assert_equal expected, @c2_c3.search_record
1285-
end
1286-
12871254
def test_store_equals
12881255
# version 2
12891256
loaded = Marshal.load "\x04\bU:\x16RDoc::NormalClass[\x0Fi\aI\"\nKlass" +

test/rdoc/code_object/method_attr_test.rb

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -124,22 +124,6 @@ def test_is_alias_for
124124
assert_equal @c2_b, @c2_a.is_alias_for
125125
end
126126

127-
def test_search_record
128-
@c1_m.comment = 'This is a comment.'
129-
130-
expected = [
131-
'm',
132-
'C1#m',
133-
'm',
134-
'C1',
135-
'C1.html#method-i-m',
136-
'(foo)',
137-
"<p>This is a comment.\n",
138-
]
139-
140-
assert_equal expected, @c1_m.search_record
141-
end
142-
143127
def test_spaceship_returns_nil_on_inappropriate_types
144128
assert_nil @c1_m.<=>(RDoc::CodeObject.new)
145129
end

test/rdoc/parser/ruby_test.rb

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2991,10 +2991,6 @@ def blah
29912991

29922992
foo = @top_level.classes.first
29932993
assert_equal 'Foo', foo.full_name
2994-
2995-
blah = foo.method_list.first
2996-
markup_comment = blah.search_record[6]
2997-
assert_equal expected, markup_comment
29982994
end
29992995

30002996
def test_parse_require_dynamic_string

test/rdoc/rdoc_top_level_test.rb

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -277,48 +277,6 @@ def test_page_name_trim_extension
277277
assert_equal 'README', tl.page_name
278278
end
279279

280-
def test_search_record
281-
assert_nil @xref_data.search_record
282-
end
283-
284-
def test_search_record_page
285-
page = @store.add_file 'README.txt'
286-
page.parser = RDoc::Parser::Simple
287-
page.comment = 'This is a comment.'
288-
289-
expected = [
290-
'README',
291-
'',
292-
'README',
293-
'',
294-
'README_txt.html',
295-
'',
296-
"<p>This is a comment.\n",
297-
]
298-
299-
assert_equal expected, page.search_record
300-
end
301-
302-
def test_search_record_main_page
303-
page = @store.add_file 'README.txt'
304-
page.parser = RDoc::Parser::Simple
305-
page.comment = 'This is a comment.'
306-
307-
@options.main_page = 'README.txt'
308-
309-
expected = [
310-
'README',
311-
'',
312-
'README',
313-
'',
314-
'index.html',
315-
'',
316-
"<p>This is a comment.\n",
317-
]
318-
319-
assert_equal expected, page.search_record
320-
end
321-
322280
def test_text_eh
323281
refute @xref_data.text?
324282

0 commit comments

Comments
 (0)