Sha256: 3a1f189f099f4c66ca94180ec56b967d8a728e29389c4f507bef8ea1225aab35

Contents?: true

Size: 441 Bytes

Versions: 1

Compression:

Stored size: 441 Bytes

Contents

# frozen_string_literal: true

require "erb"
require "yaml"
require "json"

SelfData.default_formats = [:erb, :yaml]
SelfData.default_options = {}

SelfData.add_converter :erb, -> (data, options) { ERB.new(data).result(options[:context]) }
SelfData.add_converter :json, -> (data, _options) { JSON.parse(data) }

SelfData.add_converter :yaml do |data, _options|
  YAML.respond_to?(:unsafe_load) ? YAML.unsafe_load(data) : YAML.load(data)
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
self_data-1.3.0 lib/self_data/config.rb