Class: Mbrao::ParsingEngines::Base
- Inherits:
-
Object
- Object
- Mbrao::ParsingEngines::Base
- Defined in:
- lib/mbrao/parsing_engines/base.rb
Overview
A base class for all parsers.
Direct Known Subclasses
Instance Method Summary (collapse)
-
- (String|HashWithIndifferentAccess) filter_content(_content, _locales = [], _options = {})
Filters content of a post by locale.
-
- (Object) parse(content, options = {})
Parses a content and return a Content object.
-
- (Hash) parse_metadata(_content, _options = {})
Parses metadata part and returns all valid metadata.
-
- (Array) separate_components(_content, _options = {})
Parses a whole post content and return its metadata and content parts.
Instance Method Details
- (String|HashWithIndifferentAccess) filter_content(_content, _locales = [], _options = {})
Filters content of a post by locale.
37 38 39 |
# File 'lib/mbrao/parsing_engines/base.rb', line 37 def filter_content(_content, _locales = [], = {}) raise Mbrao::Exceptions::Unimplemented end |
- (Object) parse(content, options = {})
Parses a content and return a Content object.
45 46 47 48 49 |
# File 'lib/mbrao/parsing_engines/base.rb', line 45 def parse(content, = {}) , body = separate_components(content, ) = (, ) Mbrao::Content.create(, body) end |
- (Hash) parse_metadata(_content, _options = {})
Parses metadata part and returns all valid metadata.
26 27 28 |
# File 'lib/mbrao/parsing_engines/base.rb', line 26 def (_content, = {}) raise Mbrao::Exceptions::Unimplemented end |
- (Array) separate_components(_content, _options = {})
Parses a whole post content and return its metadata and content parts.
17 18 19 |
# File 'lib/mbrao/parsing_engines/base.rb', line 17 def separate_components(_content, = {}) raise Mbrao::Exceptions::Unimplemented end |