Sha256: 69fda095d5a131d7657c8fce63af5320f5bce9d0e0670a28a4d8f7ede7700d07

Contents?: true

Size: 608 Bytes

Versions: 3

Compression:

Stored size: 608 Bytes

Contents

# frozen_string_literal: true

require "dato/dump/format/toml"
require "dato/dump/format/yaml"
require "dato/dump/format/json"

module Dato
  module Dump
    module Format
      def self.dump(format, value)
        converter_for(format).dump(value)
      end

      def self.frontmatter_dump(format, value)
        converter_for(format).frontmatter_dump(value)
      end

      def self.converter_for(format)
        case format.to_sym
        when :toml
          Format::Toml
        when :yaml, :yml
          Format::Yaml
        when :json
          Format::Json
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
dato-0.8.3 lib/dato/dump/format.rb
dato-0.8.2 lib/dato/dump/format.rb
dato-0.8.1 lib/dato/dump/format.rb