lib/self_data/config.rb in self_data-1.2.1 vs lib/self_data/config.rb in self_data-1.3.0
- old
+ new
@@ -6,7 +6,10 @@
SelfData.default_formats = [:erb, :yaml]
SelfData.default_options = {}
SelfData.add_converter :erb, -> (data, options) { ERB.new(data).result(options[:context]) }
-SelfData.add_converter :yaml, -> (data, _options) { YAML.load(data) }
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