mirror of
https://github.com/ThrowTheSwitch/Unity
synced 2025-03-12 16:11:12 -04:00
YAML.load is now interpreted as YAML.safe_load, which breaks where the YAML file contains aliases. If we can assume our yaml files are trusted (since this a development tool), we can check for the presence of YAML.unsafe_load and use it instead if it exists.
20 lines
509 B
Ruby
20 lines
509 B
Ruby
# ==========================================
|
|
# Unity Project - A Test Framework for C
|
|
# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
|
|
# [Released under MIT License. Please refer to license.txt for details]
|
|
# ==========================================
|
|
|
|
require 'yaml'
|
|
|
|
module YamlHelper
|
|
def self.load(body)
|
|
YAML.respond_to?(:unsafe_load) ?
|
|
YAML.unsafe_load(body) : YAML.load(body)
|
|
end
|
|
|
|
def self.load_file(file)
|
|
body = File.read(file)
|
|
self.load(body)
|
|
end
|
|
end
|