Skip to content

Commit 72d2bc2

Browse files
committed
Move default RDoc headings to a constant
1 parent d3195e1 commit 72d2bc2

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

lib/rdoc/markup/to_rdoc.rb

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,14 @@
33
# Outputs RDoc markup as RDoc markup! (mostly)
44

55
class RDoc::Markup::ToRdoc < RDoc::Markup::Formatter
6+
DEFAULT_HEADINGS = {
7+
1 => ['= ', ''],
8+
2 => ['== ', ''],
9+
3 => ['=== ', ''],
10+
4 => ['==== ', ''],
11+
5 => ['===== ', ''],
12+
6 => ['====== ', '']
13+
}.tap { |h| h.default = [] }.freeze
614

715
##
816
# Current indent amount for output in characters
@@ -49,16 +57,7 @@ def initialize markup = nil
4957
@width = 78
5058
init_tags
5159

52-
@headings = {}
53-
@headings.default = []
54-
55-
@headings[1] = ['= ', '']
56-
@headings[2] = ['== ', '']
57-
@headings[3] = ['=== ', '']
58-
@headings[4] = ['==== ', '']
59-
@headings[5] = ['===== ', '']
60-
@headings[6] = ['====== ', '']
61-
60+
@headings = DEFAULT_HEADINGS.dup
6261
@hard_break = "\n"
6362
end
6463

0 commit comments

Comments
 (0)