class FrontMatterParser::Loader::Yaml

{Loader} that uses YAML library

Attributes

allowlist_classes[R]

@!attribute [r] allowlist_classes Classes that may be parsed by call.

Public Class Methods

new(allowlist_classes: []) click to toggle source
# File lib/front_matter_parser/loader/yaml.rb, line 13
def initialize(allowlist_classes: [])
  @allowlist_classes = allowlist_classes
end

Public Instance Methods

call(string) click to toggle source

Loads a hash front matter from a string

@param string [String] front matter string representation @return [Hash] front matter hash representation

# File lib/front_matter_parser/loader/yaml.rb, line 21
def call(string)
  YAML.safe_load(string, permitted_classes: allowlist_classes)
end