Sha256: 53da41ce3a173bd221dcc0ea0802d3b8cf4b0f4f37dd62ada2edd6fb6478083f
Contents?: true
Size: 607 Bytes
Versions: 1
Compression:
Stored size: 607 Bytes
Contents
module Brief class Document module FrontMatter extend ActiveSupport::Concern def frontmatter @frontmatter || load_frontmatter end def frontmatter_line_count (@raw_frontmatter && @raw_frontmatter.lines.count) || 0 end protected def load_frontmatter if raw_content =~ /^(---\s*\n.*?\n?)^(---\s*$\n?)/m self.content = raw_content[($1.size + $2.size)..-1] @frontmatter_line_count = $1.lines.size @raw_frontmatter = $1 @frontmatter = YAML.load($1).to_mash end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
brief-1.2.0 | lib/brief/document/front_matter.rb |