Module: Dimples::FrontMatter
- Defined in:
- lib/dimples/frontmatter.rb
Constant Summary collapse
- PATTERN =
/^(-{3}\n.*?\n?)^(-{3}*$\n?)/m.freeze
Class Method Summary collapse
Class Method Details
.parse(contents) ⇒ Object
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/dimples/frontmatter.rb', line 9 def self.parse(contents) = {} if (matches = contents.match(PATTERN)) = YAML.safe_load(matches[1], symbolize_names: true, permitted_classes: [Date]) contents = matches.post_match.strip end [, contents] end |