Class: Slideck::MetadataParser Private
- Inherits:
-
Object
- Object
- Slideck::MetadataParser
- Defined in:
- lib/slideck/metadata_parser.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Responsible for parsing metadata in YAML format
Instance Method Summary collapse
-
#initialize(yaml_parser, symbolize_names: nil, permitted_classes: nil) ⇒ MetadataParser
constructor
Create a MetadataParser instance.
-
#parse(content) ⇒ Hash{String, Symbol => Object}
Parse metadata from content.
Constructor Details
#initialize(yaml_parser, symbolize_names: nil, permitted_classes: nil) ⇒ MetadataParser
Create a MetadataParser instance
45 46 47 48 49 |
# File 'lib/slideck/metadata_parser.rb', line 45 def initialize(yaml_parser, symbolize_names: nil, permitted_classes: nil) @yaml_parser = yaml_parser @symbolize_names = symbolize_names @permitted_classes = permitted_classes end |
Instance Method Details
#parse(content) ⇒ Hash{String, Symbol => Object}
Parse metadata from content
63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/slideck/metadata_parser.rb', line 63 def parse(content) parse_method = select_parse_method parse_params = parse_method_params(parse_method) arguments = parser_arguments(parse_params) = (parse_params) = @yaml_parser.send(parse_method, content, *arguments, **) return if symbolize_names?() @symbolize_names ? symbolize_keys() : end |