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
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/dimples/frontmatter.rb', line 7 def self.parse(contents) = {} if matches = contents.match(PATTERN) = YAML.load(matches[1], symbolize_names: true) contents = matches.post_match.strip end [, contents] end |