Sha256: e3bc0bc2780b1573ef910e9044206d6f08e3e8518b92c1653ae12bb77e61c20a

Contents?: true

Size: 738 Bytes

Versions: 4

Compression:

Stored size: 738 Bytes

Contents

# frozen_string_literal: true
require 'agave/dump/operation/create_post'

module Agave
  module Dump
    module Dsl
      class DataFile
        def initialize(operation, &block)
          @operation = operation
          instance_eval(&block)
        end

        def frontmatter(format, value)
          @operation.frontmatter_format = format
          @operation.frontmatter_value = value
        end

        def content(value)
          @operation.content = value
        end
      end

      module CreatePost
        def create_post(path, &block)
          operation = Operation::CreatePost.new(operations, path)
          DataFile.new(operation, &block)

          operations.add operation
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
agave-client-0.1.3 lib/agave/dump/dsl/create_post.rb
agave-client-0.1.2 lib/agave/dump/dsl/create_post.rb
agave-client-0.1.1 lib/agave/dump/dsl/create_post.rb
agave-client-0.1.0 lib/agave/dump/dsl/create_post.rb