Skip to content

Commit 6b1b9aa

Browse files
committed
Create Markup::Element base class
1 parent c1c3ac2 commit 6b1b9aa

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

lib/rdoc/markup.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,7 @@ def convert(input, formatter)
210210
autoload :BlankLine, "#{__dir__}/markup/blank_line"
211211
autoload :BlockQuote, "#{__dir__}/markup/block_quote"
212212
autoload :Document, "#{__dir__}/markup/document"
213+
autoload :Element, "#{__dir__}/markup/element"
213214
autoload :HardBreak, "#{__dir__}/markup/hard_break"
214215
autoload :Heading, "#{__dir__}/markup/heading"
215216
autoload :Include, "#{__dir__}/markup/include"

lib/rdoc/markup/element.rb

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# frozen_string_literal: true
2+
3+
module RDoc
4+
class Markup
5+
# Base class defining the interface for all markup elements found in documentation
6+
# @abstract
7+
class Element
8+
# @abstract
9+
#: (untyped) -> void
10+
def accept(visitor)
11+
raise NotImplementedError, "#{self.class} must implement the accept method"
12+
end
13+
14+
# @abstract
15+
#: (PP) -> void
16+
def pretty_print(q)
17+
raise NotImplementedError, "#{self.class} must implement the pretty_print method"
18+
end
19+
end
20+
end
21+
end

0 commit comments

Comments
 (0)