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
-
#filter_content(_content, _locales = [], _options = {}) ⇒ String|HashWithIndifferentAccess
Filters content of a post by locale.
-
#parse(content, options = {}) ⇒ Object
Parses a content and return a Content object.
-
#parse_metadata(_content, _options = {}) ⇒ Hash
Parses metadata part and returns all valid metadata.
-
#separate_components(_content, _options = {}) ⇒ Array
Parses a whole post content and return its metadata and content parts.
Instance Method Details
#filter_content(_content, _locales = [], _options = {}) ⇒ String|HashWithIndifferentAccess
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 |
#parse(content, options = {}) ⇒ Object
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 |
#parse_metadata(_content, _options = {}) ⇒ Hash
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 |
#separate_components(_content, _options = {}) ⇒ Array
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 |