Sha256: 7f503f945e7d93fb6d5a3ca97efb599323c343db8997b103bdb594cfd293c147

Contents?: true

Size: 513 Bytes

Versions: 1

Compression:

Stored size: 513 Bytes

Contents

# frozen_string_literal: true

require "active_support/core_ext/hash/keys"
require "toml"

class Time
  def to_toml(_path = "")
    utc.strftime("%Y-%m-%dT%H:%M:%SZ")
  end
end

class Date
  def to_toml(_path = "")
    strftime("%Y-%m-%d")
  end
end

module Dato
  module Dump
    module Format
      module Toml
        def self.dump(value)
          TOML::Generator.new(value).body
        end

        def self.frontmatter_dump(value)
          "+++\n#{dump(value)}+++"
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dato-0.8.1 lib/dato/dump/format/toml.rb