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.
36 37 38 |
# File 'lib/mbrao/parsing_engines/base.rb', line 36 def filter_content(content, locales = [], = {}) raise Mbrao::Exceptions::Unimplemented.new end |
- (Object) parse(content, options = {})
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 |
- (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.new 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.new end |