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.
36 37 38 |
# File 'lib/mbrao/parsing_engines/base.rb', line 36 def filter_content(content, locales = [], = {}) raise Mbrao::Exceptions::Unimplemented.new end |
#parse(content, options = {}) ⇒ Object
Parses a content and return a Content object.
44 45 46 47 48 |
# File 'lib/mbrao/parsing_engines/base.rb', line 44 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.new 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.new end |