Sha256: 62b82973b278089f2acf5cc52f94dcea974f22dfa5de8b0744a8c26704d55ca4
Contents?: true
Size: 680 Bytes
Versions: 10
Compression:
Stored size: 680 Bytes
Contents
# frozen_string_literal: true module Bridgetown module Utils module RubyFrontMatterDSL def front_matter(&block) RubyFrontMatter.new.tap { |fm| fm.instance_exec(&block) } end end class RubyFrontMatter def initialize @data = {} end def method_missing(key, value) # rubocop:disable Style/MissingRespondToMissing return super if respond_to?(key) set(key, value) end def each(&block) @data.each(&block) end def get(key) @data[key] end def set(key, value) @data[key] = value end def to_h @data end end end end
Version data entries
10 entries across 10 versions & 1 rubygems