Module: Agave::Dump::Format

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

Defined Under Namespace

Modules: Json, Toml, Yaml

Class Method Summary collapse

Class Method Details

.converter_for(format) ⇒ Object



16
17
18
19
20
21
22
23
24
25
# File 'lib/agave/dump/format.rb', line 16

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



8
9
10
# File 'lib/agave/dump/format.rb', line 8

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

.frontmatter_dump(format, value) ⇒ Object



12
13
14
# File 'lib/agave/dump/format.rb', line 12

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