Class: Phronomy::OutputParser::Base
- Inherits:
-
Object
- Object
- Phronomy::OutputParser::Base
- Includes:
- Runnable
- Defined in:
- lib/phronomy/output_parser/base.rb
Overview
Base class for all output parsers. Can be embedded in a Chain as a Runnable.
Direct Known Subclasses
Instance Method Summary collapse
-
#invoke(input, config: {}) ⇒ Object
Parsed result.
-
#parse(text) ⇒ Object
Implement in subclasses.
Methods included from Runnable
Instance Method Details
#invoke(input, config: {}) ⇒ Object
Returns parsed result.
12 13 14 |
# File 'lib/phronomy/output_parser/base.rb', line 12 def invoke(input, config: {}) parse(input.is_a?(String) ? input : input.to_s) end |
#parse(text) ⇒ Object
Implement in subclasses.
17 18 19 |
# File 'lib/phronomy/output_parser/base.rb', line 17 def parse(text) raise NotImplementedError, "#{self.class}#parse is not implemented" end |