Skip to content

Commit 34051e6

Browse files
committed
Standardize Rule markup
1 parent c470a24 commit 34051e6

File tree

1 file changed

+29
-12
lines changed

1 file changed

+29
-12
lines changed

lib/rdoc/markup/rule.rb

Lines changed: 29 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,37 @@
11
# frozen_string_literal: true
2-
##
3-
# A horizontal rule with a weight
42

5-
class RDoc::Markup::Rule < Struct.new :weight
3+
module RDoc
4+
class Markup
5+
# A horizontal rule with a weight
6+
class Rule < Element
7+
#: Integer
8+
attr_reader :weight
69

7-
##
8-
# Calls #accept_rule on +visitor+
10+
#: (Integer) -> void
11+
def initialize(weight)
12+
super()
13+
@weight = weight
14+
end
915

10-
def accept(visitor)
11-
visitor.accept_rule self
12-
end
16+
#: (top) -> bool
17+
def ==(other)
18+
other.is_a?(Rule) && other.weight == @weight
19+
end
20+
21+
# Calls #accept_rule on +visitor+
22+
# @override
23+
#: (untyped) -> void
24+
def accept(visitor)
25+
visitor.accept_rule(self)
26+
end
1327

14-
def pretty_print(q) # :nodoc:
15-
q.group 2, '[rule:', ']' do
16-
q.pp weight
28+
# @override
29+
#: (PP) -> void
30+
def pretty_print(q) # :nodoc:
31+
q.group(2, '[rule:', ']') do
32+
q.pp(weight)
33+
end
34+
end
1735
end
1836
end
19-
2037
end

0 commit comments

Comments
 (0)