Sha256: 97ac2bdb2b5954b520e832e202e0ed61b1d94c2cb4d563f9e1f4114c16a3ba6d
Contents?: true
Size: 585 Bytes
Versions: 1
Compression:
Stored size: 585 Bytes
Contents
require 'yaml' module WP2Middleman class Frontmatter def initialize(post, include_fields: []) @post = post @include_fields = include_fields end def post_data data = { 'title' => post.title, 'date' => post.date_published, 'tags' => post.tags } data['published'] = false if !post.published? include_fields.each do |field| data[field] = post.field(field) end data end def to_yaml post_data.to_yaml.strip end private attr_reader :post, :include_fields end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
wp2middleman-0.0.2 | lib/wp2middleman/frontmatter.rb |