Module: Gram::Blog::Parser
- Defined in:
- lib/gram/blog/parser.rb
Class Method Summary collapse
Class Method Details
.parse(file) ⇒ Object
8 9 10 11 12 13 14 15 16 |
# File 'lib/gram/blog/parser.rb', line 8 def parse(file) raw_content = File.read(file) headers = raw_content.match(/---(.*)---/m) yaml = YAML.load($1.strip) content = raw_content.gsub(/---.*---/m, '').strip yaml.update({ 'body' => content }) end |