Skip to content

Commit 858d997

Browse files
committed
Remove RDoc::Comment#remove_private
It was changed in b92986a and can now be removed entirely
1 parent 22d1674 commit 858d997

2 files changed

Lines changed: 0 additions & 175 deletions

File tree

lib/rdoc/comment.rb

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -187,28 +187,6 @@ def parse
187187
@document
188188
end
189189

190-
##
191-
# Removes private sections from this comment. Private sections are flush to
192-
# the comment marker and start with <tt>--</tt> and end with <tt>++</tt>.
193-
# For C-style comments, a private marker may not start at the opening of the
194-
# comment.
195-
#
196-
# /*
197-
# *--
198-
# * private
199-
# *++
200-
# * public
201-
# */
202-
203-
def remove_private
204-
# Workaround for gsub encoding for Ruby 1.9.2 and earlier
205-
empty = ''
206-
empty = RDoc::Encoding.change_encoding empty, @text.encoding
207-
208-
@text = @text.gsub(%r%^\s*([#*]?)--.*?^\s*(\1)\+\+\n?%m, empty)
209-
@text = @text.sub(%r%^\s*[#*]?--.*%m, '')
210-
end
211-
212190
##
213191
# Replaces this comment's text with +text+ and resets the parsed document.
214192
#

test/rdoc/rdoc_comment_test.rb

Lines changed: 0 additions & 153 deletions
Original file line numberDiff line numberDiff line change
@@ -324,159 +324,6 @@ def test_parse_rd
324324
assert_equal expected, c.parse
325325
end
326326

327-
def test_remove_private_encoding
328-
comment = RDoc::Comment.new <<-EOS, @top_level
329-
# This is text
330-
#--
331-
# this is private
332-
EOS
333-
334-
comment = RDoc::Encoding.change_encoding comment, Encoding::IBM437
335-
336-
comment.remove_private
337-
338-
assert_equal Encoding::IBM437, comment.text.encoding
339-
end
340-
341-
def test_remove_private_hash
342-
@comment.text = <<-TEXT
343-
#--
344-
# private
345-
#++
346-
# public
347-
TEXT
348-
349-
@comment.remove_private
350-
351-
assert_equal "# public\n", @comment.text
352-
end
353-
354-
def test_remove_private_hash_trail
355-
comment = RDoc::Comment.new <<-EOS, @top_level
356-
# This is text
357-
#--
358-
# this is private
359-
EOS
360-
361-
expected = RDoc::Comment.new <<-EOS, @top_level
362-
# This is text
363-
EOS
364-
365-
comment.remove_private
366-
367-
assert_equal expected, comment
368-
end
369-
370-
def test_remove_private_long
371-
comment = RDoc::Comment.new <<-EOS, @top_level
372-
#-----
373-
#++
374-
# this is text
375-
#-----
376-
EOS
377-
378-
expected = RDoc::Comment.new <<-EOS, @top_level
379-
# this is text
380-
EOS
381-
382-
comment.remove_private
383-
384-
assert_equal expected, comment
385-
end
386-
387-
def test_remove_private_rule
388-
comment = RDoc::Comment.new <<-EOS, @top_level
389-
# This is text with a rule:
390-
# ---
391-
# this is also text
392-
EOS
393-
394-
expected = comment.dup
395-
396-
comment.remove_private
397-
398-
assert_equal expected, comment
399-
end
400-
401-
def test_remove_private_star
402-
@comment.text = <<-TEXT
403-
/*
404-
*--
405-
* private
406-
*++
407-
* public
408-
*/
409-
TEXT
410-
411-
@comment.remove_private
412-
413-
assert_equal "/*\n * public\n */\n", @comment.text
414-
end
415-
416-
def test_remove_private_star2
417-
@comment.text = <<-TEXT
418-
/*--
419-
* private
420-
*++
421-
* public
422-
*/
423-
TEXT
424-
425-
@comment.remove_private
426-
427-
assert_equal "/*--\n * private\n *++\n * public\n */\n", @comment.text
428-
end
429-
430-
def test_remove_private_toggle
431-
comment = RDoc::Comment.new <<-EOS, @top_level
432-
# This is text
433-
#--
434-
# this is private
435-
#++
436-
# This is text again.
437-
EOS
438-
439-
expected = RDoc::Comment.new <<-EOS, @top_level
440-
# This is text
441-
# This is text again.
442-
EOS
443-
444-
comment.remove_private
445-
446-
assert_equal expected, comment
447-
end
448-
449-
def test_remove_private_toggle_encoding
450-
comment = RDoc::Comment.new <<-EOS, @top_level
451-
# This is text
452-
#--
453-
# this is private
454-
#++
455-
# This is text again.
456-
EOS
457-
458-
comment = RDoc::Encoding.change_encoding comment, Encoding::IBM437
459-
460-
comment.remove_private
461-
462-
assert_equal Encoding::IBM437, comment.text.encoding
463-
end
464-
465-
def test_remove_private_toggle_encoding_ruby_bug?
466-
comment = RDoc::Comment.new <<-EOS, @top_level
467-
#--
468-
# this is private
469-
#++
470-
# This is text again.
471-
EOS
472-
473-
comment = RDoc::Encoding.change_encoding comment, Encoding::IBM437
474-
475-
comment.remove_private
476-
477-
assert_equal Encoding::IBM437, comment.text.encoding
478-
end
479-
480327
def test_parse_directives
481328
comment = <<~COMMENT
482329
comment1

0 commit comments

Comments
 (0)