Module: Dato::Dump::Format

Defined in:
lib/dato/dump/format.rb,
lib/dato/dump/format/json.rb,
lib/dato/dump/format/toml.rb,
lib/dato/dump/format/yaml.rb

Defined Under Namespace

Modules: Json, Toml, Yaml

Class Method Summary collapse

Class Method Details

.converter_for(format) ⇒ Object



18
19
20
21
22
23
24
25
26
27
# File 'lib/dato/dump/format.rb', line 18

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

.dump(format, value) ⇒ Object



10
11
12
# File 'lib/dato/dump/format.rb', line 10

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

.frontmatter_dump(format, value) ⇒ Object



14
15
16
# File 'lib/dato/dump/format.rb', line 14

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