Class: Markdownator::Converters::Base
- Inherits:
-
Object
- Object
- Markdownator::Converters::Base
- Defined in:
- lib/markdownator/converters/base.rb
Overview
Abstract base class for all converters.
A converter is asked, in priority order, whether it ‘accepts?` a stream; the first one that does has its `convert` called. Subclasses must override both methods. The stream passed in is a rewound IO positioned at byte 0.
Instance Method Summary collapse
-
#accepts?(_io, _stream_info) ⇒ Boolean
Whether this converter can handle the given stream.
- #convert(_io, _stream_info, **_options) ⇒ Markdownator::Result
Instance Method Details
#accepts?(_io, _stream_info) ⇒ Boolean
Returns whether this converter can handle the given stream.
12 13 14 |
# File 'lib/markdownator/converters/base.rb', line 12 def accepts?(_io, _stream_info) raise NotImplementedError, "#{self.class} must implement #accepts?" end |
#convert(_io, _stream_info, **_options) ⇒ Markdownator::Result
17 18 19 |
# File 'lib/markdownator/converters/base.rb', line 17 def convert(_io, _stream_info, **) raise NotImplementedError, "#{self.class} must implement #convert" end |